...

View Full Version : change a link's target based on a current image



insidi0us
10-23-2005, 10:03 PM
several weeks ago i asked a few questions and got a few answers regarding
swapping more than 2 images back and forth in the same space.
the solution was to use a function and put my 4 images in an array and have my left and right arrows just shiftleft and shiftright, calling the appropriate images. this worked great :D

now im wondering if i can have a link elsewhere on my page point to multiple different
pages or execute different actions, BASED on which image is currently on display.

so say i have 4 images that i can loop thru using left and right arrows.
i scroll thru them and leave it on image3 and then go click a button - and it plays a sound.
then i swap the image again to image2, and click the same button, but this time it shows a layer that was hidden by default. swap again to say image4, and then click my button again and i go to a new page.

is this possible?

Lerura
10-24-2005, 01:34 AM
Hello again indisi0us;

if you use the script and page from the other thread (http://www.codingforums.com/showthread.php?t=69142) then you can use this script:


function DoThat(){
if (document.picture.src=Picture[0]){
..... do that ....
}
if (document.picture.src=Picture[1]){
..... do that ....
}
etc.
}
but if you want to refer directly to the image use this

function DoThat(){
if (document.picture.src='MyMom.gif'){
..... do that ....
}
if (document.picture.src='MyDad.gif'){
..... do that ....
}
etc.
}

and then either

<input type="button" onClick="DoThat();" value="Click Here">
or

<a href="javascript:DoThat()">Click here</a>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum