PDA

View Full Version : Ultimate Fade-in slideshow - add an onClick event to an image link



button1
04-02-2006, 12:16 PM
Regarding the link and link target for individual images:

I am trying to add a onClick event to one of the image links. The onClick event looks like:

onClick="NewWindow(this.href,'name','500','400','yes');return false"

Any ideas?

Twey
04-02-2006, 12:23 PM
Fish.

button1
04-02-2006, 12:35 PM
Oops.... The link to the Ultimate Fade-in slideshow is:
http://www.dynamicdrive.com/dynamicindex14/fadeinslideshow.htm

Twey
04-02-2006, 01:26 PM
Well, the easiest way to do it is to use the javascript: pseudo-URL scheme. However, this isn't very friendly to non-JS browsers.
Try changing this:
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'to this:
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'" onclick="' + this.theimages[picindex][3] + '">'That will allow you to add an onclick event into the array after the target.

button1
04-02-2006, 01:57 PM
Thanks Twey,

I modified the script as stated - Great so far!

Now this is how stupid I am - Is there any way you can help me with the proper syntax to add the onclick event into the array after the target. The onClick event I am trying to add is as follows:

onClick="NewWindow(this.href,'name','500','400','yes');return false"

Thanks Bill

Twey
04-02-2006, 02:23 PM
For example:
fadeimages[2]=["photo3.jpg", "http://www.javascriptkit.com", "_new", "NewWindow(this.href,'name','500','400','yes');"]

button1
04-02-2006, 02:51 PM
Thanks-a-million Twey,

Works Great! Could not have done it without your help :)

Bill

jscheuer1
04-02-2006, 04:29 PM
Well, the easiest way to do it is to use the javascript: pseudo-URL scheme. However, this isn't very friendly to non-JS browsers.

Huh? Without javascript, there would be no link to begin with.

Twey
04-02-2006, 05:23 PM
Without javascript, there would be no link to begin with.D'oh.