Trying to do a simple image swap , but i have to do this with 48 buttons (for half hour inrements in a day, and there might be several days)… i’m trying to get this to work with 1 function. I could brute force a function for everyday … but i don’t obviously want to do that.
heres a small sample
<head>
<script type=”text/javascript”>
var1 =”buttons/100a_off.bmp”;
var2 =”buttons/100a_on.bmp”;
var26 = “IMG1”;
var27 = “IMG2”;
function swapImage(txt1,txt2,counter,picSource) {
switch (counter) {
case 1:
alert(txt1);
picSource.src = txt1
counter = 2
return counter;
case 2:
alert(txt2);
picSource.src = txt2
counter = 1
return counter;
}
}
</script>
</head>
<body>
<IMG id=var26 name=”IMG1″ src=”buttons/100a_off.bmp”
onclick=”intImage1 = swapImage(var1,var2, intImage1, var26);”>
<IMG id=var27 name=”IMG2″ src=”buttons/130a_off.bmp”
onclick=”intImage2 = swapImage(var3,var4,intImage2, var27);”>
</body>
It’s so simple and the first button works, the second butter turn’s “On” or is highlighted ( which is the swap.. ) but it won’t turn off.. even though the alert shows that it is being accessed and the correct location is being passed in.
Thanks for any help