bnd10706 Posted July 20, 2012 Share Posted July 20, 2012 So I have a many images that I want the user to be able to toggle.very much like thishttp://www.w3schools.com/dhtml/tryit.asp?filename=trydhtml_intro the only issue I have is that using that code I cannot seem to make another image toggle. I rewrote the scrpt as follows, the only issue I have is that I cannot toggle it back. Any ideas? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>Untitled Document</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="Content-Style-Type" content="text/css"><meta http-equiv="Content-Script-Type" content="text/javascript"><script type="text/javascript">function changeImg(img, newimg) {img.src = newimg;}</script><body><img onclick="changeImg(this, 'staten_uw.jpg')" src="staten_moored.jpg"><img onclick="changeImg(this, 'block_uw.jpg')" src="block_moored.jpg"></body></html> Link to comment Share on other sites More sharing options...
justsomeguy Posted July 20, 2012 Share Posted July 20, 2012 You can probably pass both filenames to the function, and have the function figure out which one is currently displayed and display the other one. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now