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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.