Ultimate Web Site Drop Down Menu Forum

Ultimate Web Site Drop Down Menu Forum (http://www.udm4.com/forum/index.php)
-   Javascript (http://www.udm4.com/forum/forumdisplay.php?f=9)
-   -   copy source_image src to another image from onclick (http://www.udm4.com/forum/showthread.php?t=611)

bcarl314 09-05-2007 05:25 AM

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

11-15-2007 10:24 AM

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 11:52 AM.

Powered by vBulletin® Version 3.0.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.