very dumb javascript popup window question

MisterServer

Senior member
Dec 29, 1999
271
0
71
hi, javascript noob here! i've got a page full of images, what i simply want to do is have a popup window open up if i click on an image. also, clicking on another image in the page should refresh that popup window with the new image. can't figure out how to do the refreshing part! tia!:beer::D
 

jonmullen

Platinum Member
Jun 17, 2002
2,517
0
0
<script language="JavaScript">
function openpic(picturepath){
if(picswindow){
windows.picswindow.location = "picturepath";
}else
window.open("picturepath","picswindow");
}
}
</script>

Ok put the above script into the head of the main page with all the pictures. Than for all the images should have an onClick event like this. <img src="pathtothumbnail.jpg" onClick="openpic(fullsizedpic.jpg)">
 

MisterServer

Senior member
Dec 29, 1999
271
0
71
Yes! thank you jonmullen... btw, got any javascript tutorial sites u'd recommend to a noob like me?
 

MisterServer

Senior member
Dec 29, 1999
271
0
71
ok, ran into another problem. eventually i got each of my images to popup to the same popup window, with that popup window focused on. but when I close down that popup window, i get an error and i can't open another popup window... can anyone tell me what im doing wrong?
 

jonmullen

Platinum Member
Jun 17, 2002
2,517
0
0
Google your error msg...as far as sites, i just google for anything I dont know how to do, Javascript is a pretty easy language if you ask me especially if you have previous programing experience. In my function I had a type of instead of windows.picswindow.location it should be window.picwindows.location sorry, and you might want to add window.picslocation.focus() to make sure it brings the popup into focus but you might have already figured that out.