View Full Version : Photo gallery thumbnails issue

11-19-2012, 11:15 PM

This is my first post to this forum so if I'm not posting this in the proper place, I apologize. I'm pretty much a beginner in learning CSS/HTML. I'm currently trying to add a simple photo gallery to a page I'm creating for a website and I'm having an issue with the thumbnails. The thumbnails are working as they should, correctly linking to the image, but the thumbnails images keep changing when clicked? I'm not sure why and can't seem to figure out a solution. Any help would be appreciated!

<script type='text/javascript'>
function changeimg( number, src ) {
//Get big picture source
var big_picture = document.getElementById( "big_picture" ).src;

//Change big picture source
document.getElementById( "big_picture" ).src = src;

//Replace clicked picture with big picture
document.getElementById( "small_picture" + number ).src = big_picture;



#big_picture {

.small_picture {


<img id='big_picture' src="Logo1image.jpg" />

<img id='small_picture1' class='small_picture'
src="TK_Thumb1.jpg" onClick='changeimg( 2, this.src="Logo1image.jpg");' style="padding-left:0px;" />

<img id='small_picture2' class='small_picture' src="TK_Thumb2.jpg" onClick='changeimg( 2, this.src="Logo2image.jpg");' style="padding-left:20px;" />

<img id='small_picture3' class='small_picture' src="TK_Thumb3.jpg" onClick='changeimg( 2, this.src="Logo3image.jpg");' style="padding-left:20px;" />

<img id='small_picture4' class='small_picture'src="TK_Thumb4.jpg" onClick='changeimg( 2, this.src="Logo4image.jpg");' style="padding-left:20px;" />

11-20-2012, 08:16 AM
This is for javascript part of forum, anyway this does not make any sence:

function changeimg( number, src )

onClick='changeimg( 2, this.src="Logo2image.jpg");'

it would mybe make sence:

onClick='changeimg( 2, "Logo2image.jpg");'

11-20-2012, 04:21 PM
That actually worked! Thank you so much!

-- I also changed all the numbers within the parentheses to 0.