PDA

View Full Version : help with Javascript Pop-ups



blatantdream
April 22nd, 2004, 12:08 PM
I am doing this website which has a pop-up page when you enter the page. Once you get into the main part, there are a couple of frames and a page that suppose to be a photo gallery. I have the photo gallery so that the when clicking on the thumbnails, the javascript will tell it to open another popup window constraining the size of the window to fit around the larger picture. The photo gallery as at
http://www.blatantdream.com/aion/photo.htm (http://www.blatantdream.com/aion/photo.htm)

However, if you go through the regular way through the main page
http://www.blatantdream.com/aion/ (http://www.blatantdream.com/aion/) , when you click on the photo part and click on a picture, it opens up on top of the entire window. Is there a way to fix this?

This is the script I used:

<script language="javascript">
function openWin(file)
{
var popUpWidth = 500;
var popUpHeight = 375;
var popUpTop = (screen.height - popUpHeight) / 2;
var popUpLeft = (screen.width - popUpWidth) / 2;
window.open(file, 'live', 'top='+popUpTop+',left='+popUpLeft+',height='+popU
pHeight+',width='+popUpWidth);
}
</script>

and to open:

<a href="#" onclick="javascript:OpenWin('pics/live1.jpg');"><img src="pics/live1_th.gif" border="0"></a>

Hans Kilian
April 22nd, 2004, 04:59 PM
That's because you 'name' a pop-up window when you call window.open. You use 'live' as the name for both your pop-ups and that's why the pictures get shown in the 'live' window that's already open. Try calling one of the windows something else. Like changing the code above to

window.open(file, 'picture', 'top='+popUpTop+',left='+popUpLeft+',height='+popU
pHeight+',width='+popUpWidth);

blatantdream
April 24th, 2004, 11:05 PM
Thank you so much for your help. I can't believe I didn't realize that on my own.