johnrcornell Posted August 28, 2007 Share Posted August 28, 2007 Here's my JS in the HEAD section: <script language="Javascript"> function toggleclock(clock) { if (clock.state = 'on') { clock.src = 'includes/png/clock_color.png' clock.state = 'off' } else if (clock.state = 'off') { clock.src = 'includes/png/clock_bw.png' clock.state = 'on' } } </script> And here's in the BODY section: <img src="includes/png/clock_bw.png" border=0 onload="this.state='off'" onclick="toggleclock(this)" style="cursor: pointer;" /> The script seems perfectly logical, I never have problems like this in PHP this is why I hate JavaScript. I can never get even simple things to work let alone complicated things. I'm sure I'm just misunderstanding. Does anyone see what's wrong? The results are that it'll toggle the image initially from clock_bw.png to clock_color.png, but once it's toggled to color it will not toggle back to black and white. Thanks for anyone with insight. This is holding up the show on this project! Ricky Quote Link to comment Share on other sites More sharing options...
johnrcornell Posted August 28, 2007 Author Share Posted August 28, 2007 Changing the comparison operator to == makes it work in IE but not FF Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.