PDA

View Full Version : HTML links with in html to active page change/new page



simondavies
15 Sep 2011, 1:55 PM
I have this image (several) within my html section, and would like each one to become a link to separate pages within my application, so 'onclick' they would slide in a page with content or a list view etc.

How 'or is it possible' to do this.

existdissolve
15 Sep 2011, 6:08 PM
Once the HTML is ready, you could apply some click handlers to your images:



Ext.get("mycontentid").select("img[class=someselector]").each(function(){
this.on("click",function(){
// when image is clicked, do something....
somepanel.setActiveItem(...)
...
or whatever else...
});
})

lucaverrascina
16 Sep 2011, 2:09 AM
Would it work also with an html table's cell?

simondavies
16 Sep 2011, 4:19 AM
Thansk for the reply, but how woudl I associat this to the actual image, I mean how would I place it in order for it to run?

Say I have:


var homePanelBtm = new Ext.Carousel ({
items: [{
html: [ '<div id="homeIcons"><img class="button-one" src="img/icon/homeIcon_theatre.png" width="65" height="90" /></div>' .......

then have:


Ext.get("homeIcons").select("img[class=button-one]").each(function(){
this.on("click",function(){
console.log('I have been clicked');
});
})

How do I initiate the then link to run etc, as if I run as is then I get the following error:

Uncaught TypeError: Cannot call method 'select' of null

Testing in Chrome browser using console.

Thanks