nd3_2000 Posted January 19, 2010 Share Posted January 19, 2010 hi guys, I have looked over Google for this and cant seem to find what I need atall! Basically I have a webpage with small thumbs at the bottom and a main image at the top, I would like to change the main image on the page when I click on any of the thumbnails......... Does anybody have a function they can provide me with or giudance for this as I thought this wqould be easy to find but its not apparantly Cheers Neil Quote Link to comment Share on other sites More sharing options...
marlonbtx Posted January 20, 2010 Share Posted January 20, 2010 if you want to fire the event on your thumbs set this attribute, to each one : <image src=".." onclick="changeMainImage('put here the path of you main image');" > then you can put this function on a script tag: <script type="text/javascript"> function changeMainImage(url) { /*now here you have to get the element of you main top image, supposing that you are usins as an id "myMainImage" ok! */ var mainImage = document.getElementById('myMainImage'); // here we are setting to the maing image the path you receive as a param mainImage.src = url; } </script> and i think that's all Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.