Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop-up window trouble - Javascript 1

Status
Not open for further replies.

JennyW

Technical User
Mar 1, 2001
323
CA
Hi,
I’m using Javascript to make my pop-up windows.
I want to make multiple pop-up windows on one page, but I’m having trouble because the height and width commands in my html script make all the pop-up windows the same size.
I want each pop-up window to have its own height and width specification.

Here’s the code I’m using…

<html>
<head>
<title>pop-up test</title>

<SCRIPT TYPE=&quot;text/javascript&quot;>
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, 'width=400, height=200,left=50,top=100,resizable=0,scrollbars=yes');
return false;

}
//-->
</SCRIPT>

</head>
<body>

<a href=&quot;006_pop_win.html&quot; onClick=&quot;return popup(this, '0006Jenny')&quot;>LLLLOCATION</a>

</body>
</html>

Please help me if you can!
Thanks,
Jenny
 
you could just pass it values for the height and width, just as you have for the window name, and then use those to determine your height and width...

or am i not understanding your question?
 
Hi,
Thanks for the reply.
So, you're saying that I can just take the height and width out of the javascript and put it in my html code?

Thanks,
Jenny
 
No, I'm saying that you can send your function different values each time you call it in your html tags --

<a href=&quot;006_pop_win.html&quot; onClick=&quot;return popup(this, '0006Jenny',300,400)&quot;>

function popup(mylink, windowname, height, width)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
var x = window.open(href, windowname, 'left=50,top=100,resizable=0,scrollbars=yes');
return false;
x.width = width;
x.height = height;
}

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top