Doing a site for a Course project which needs to have some Javascript functionality. I've very new to this and I can't get it as I want.
I wanted to set up a gallery with a number of thumbnails and a main image. When you click on a thumb then the main image changes to the appropiate picture. I have tryed it here: Gallery Test
As you can see it is working but I needed to write a new function for each thumbnail click. Is there any way to combine this to a single function.
I don't know how to generate a variable with the link. This Line:
<a id = "a1" href="javascript:doChange1()"><img src="1.jpg"></a>
So that it can be taken into the function and used to change the SRC for the main image.
Any ideas?
Thanks.
I wanted to set up a gallery with a number of thumbnails and a main image. When you click on a thumb then the main image changes to the appropiate picture. I have tryed it here: Gallery Test
As you can see it is working but I needed to write a new function for each thumbnail click. Is there any way to combine this to a single function.
I don't know how to generate a variable with the link. This Line:
<a id = "a1" href="javascript:doChange1()"><img src="1.jpg"></a>
So that it can be taken into the function and used to change the SRC for the main image.
Any ideas?
Thanks.