Jump to content

Simple.Image.Toggle='pull out hair'


johnrcornell

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/67086-simpleimagetogglepull-out-hair/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.