I have this function, and I want to pass a variable (z) to the OnClick event of an image.
I have this:
for (z=1; z<img_src.length; z++){
path_th_img= 'ad_images/'+category+'/'+'thumbs/'+img_src[z];
document.getElementById("thumb_pic_div").innerHTML += "<img src='"+path_th_img+"' class='shadow2' style='margin:7px;' onclick='imageShow(z);'>";
}
img_src.lengt is in this case 4… So no matter which of the three images I click, the nr 4 gets passed on… ideas?
Thanks
you have to pass the value of z in your string