Mar 17, 2006 #1 jemmsey Programmer Joined Mar 17, 2006 Messages 1 Location GB Hi, I'm trying to use the Onclick function to click on one image so another one is shown in the same place and a sound is played. Any ideas? Thanks
Hi, I'm trying to use the Onclick function to click on one image so another one is shown in the same place and a sound is played. Any ideas? Thanks
Mar 18, 2006 #2 tiamat2012 Programmer Joined Dec 12, 2004 Messages 144 Location US Do you mean that you want to have an image, that when clicked, replaces itself with another image and plays a sound? If so, it shouldn't be that hard. I haven't tested this code but you could give it a try: Code: <script language="Javascript" type="text/javascript"> function changeme(cimage) { cimage.src="secondbla.gif"; return true; } </script> and in the html Code: <img src="bla.gif" onclick="changeme(this);"> I'm not sure how to insert sound, but I'm sure you can find that somewhere, then you would just stick it in the javascript function. -Kerry Upvote 0 Downvote
Do you mean that you want to have an image, that when clicked, replaces itself with another image and plays a sound? If so, it shouldn't be that hard. I haven't tested this code but you could give it a try: Code: <script language="Javascript" type="text/javascript"> function changeme(cimage) { cimage.src="secondbla.gif"; return true; } </script> and in the html Code: <img src="bla.gif" onclick="changeme(this);"> I'm not sure how to insert sound, but I'm sure you can find that somewhere, then you would just stick it in the javascript function. -Kerry