...

View Full Version : PopUP? Parent,Top,Blank,....... which to use?



robwri32
03-25-2005, 09:31 PM
ok i i need to acomplish something here and i think javascript might be my best answer. What i'm trying to do is when a user clicks on a image i would like for a pop up to show a larger image.... no problems there... i've been using _blank as the target. now the problem i'm having is reusing the same window. the last thing i want is the end-user having 15 pop-ups on the browser when their finished look at my page. so if someone could offer some advice on how to do this it would be great.


Thanks in Advance

ROB

Brandoe85
03-26-2005, 12:47 AM
You can pass the same window name to each window you open:


<html>
<head>
<script type="text/javascript">
function popWin(url, name)
{
window.open(url, name, height="200", width="200");
}
</script>
</head>
<body>
<form name="" action="" method="">
<input type="button" value="Google" onclick="popWin('http://www.google.com', 'Google');"><br>
<input type="button" value="Coding Forums" onclick="popWin('http://www.codingforums.com', 'Google');">
</form>
</body>
</html>

robwri32
03-26-2005, 12:55 AM
i'm actually looking for a javascript, also i was thinking it may be as simple as opening a specifiy window ( or one i name maybe) i'm just not sure i how or what i'm trying to do

Brandoe85
03-26-2005, 01:07 AM
Perhaps you can explain, I don't get what you mean?

robwri32
03-26-2005, 01:11 AM
here is what i've got up http://z-netics.com/shiloh/rob/robshilohleft.htm what i would like to do is, when the user click on an image i would like a pop that displays a larger version of that image, but i want to use the same window if the click on another image. thus avoiding too many popup window being opened. oh jea i used a little program simauar to flash called swish and i can add java script to each individual image


PS. i Added you to my msn messenger
robwri32@hotmail.com

_Aerospace_Eng_
03-26-2005, 01:21 AM
maybe this script will suffice?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title></title>
<script type="text/javascript">
function writeimg(imageURL,what,wid,hgt)
{
sh=(screen.height-hgt)/2;
sw=(screen.width-wid)/2;
imgWin = window.open('','imgWin','width='+wid+',height='+hgt+',top='+sh+',left='+sw+'');
imgWin.document.write('<html><head><title>'+what+'</title>');
imgWin.document.write('<style type="text/css"><!-- body { margin: 0px;padding:0px; } --></style></head>');
imgWin.document.write('<body><img src="'+imageURL+'" width="'+wid+'" height="'+hgt+'"></body></html>');
imgWin.document.close();
imgWin.self.focus();
imgWin.window.resizeTo(wid,hgt);
imgWin.window.moveTo(sw,sh);
}
</script>
</head>
<body>
<a href="smallimage1.jpg" onClick="writeimg(this.href,'the title is here','438','80');return false">Big Image1</a>
<a href="smallimage2.jpg" onClick="writeimg(this.href,'different title','150','150');return false">Big Image2</a>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum