copy source_image src to another image from onclick
Hi Forum, Im having trouble with my js. I have a series of img tags. each one needs to run a function with the onclick event. In the function I want to copy the src of the image into the src of a main -larger- img tag. I tried something like this: function doit(){ var node = this; var...
|
Try this
<script type="text/javascript"> function doIt(obj){ document.getElementById("bigpic").src=obj.src } </script> <img src="pic1.jpg" width="100px" height="100px" onclick="doIt(this)"> <img src="pic2.jpg" width="100px" height="100px" onclick="doIt(this)"> <img src="pic3.jpg" width="100px" height="100px" onclick="doIt(this)"> <img src="pic4.jpg" width="100px" height="100px" onclick="doIt(this)"> <img id="bigpic" src="blank.jpg"> |
All times are GMT. The time now is 10:18 AM. |
Powered by vBulletin® Version 3.0.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.