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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

popup browser instead of window

Status
Not open for further replies.

SheriSteff

Programmer
Sep 28, 2002
2
US
Hello!

I am trying to get a popup window but instead, a full browser window is opening instead. Everything seems right, but I am hoping maybe fresh eyes can spot some problems

<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<script language=JavaScript>
<!-- hide script from old browsers

function openWindow()
{
var popwin = window.open(&quot;popup.html&quot;, &quot;popup&quot;, &quot;width=120, height=220, left=20, top=5, screenx=20, screeny=5&quot;);
}

function openWindow()
{
var remotewin = window.open(&quot;remote.html&quot;,&quot;remote&quot;,&quot;width=180, height=180, left=800, top=5, screenx=800, screeny=5&quot;);
}



//end hiding script from old browsers -->
</script>

</head>

<body onLoad=&quot;javascript:window.open('popup.html')&quot;>


<a name=&quot;Top&quot;></a>
<center>
<h2>JavaScript Operators</h2>
<a href=&quot;javascript:eek:penWindow('remote.html')&quot;>Remote Window</a></center>
<hr>
<p>
 
Hi,

A few things:-
1) You seem to have two functions of the same name - openWindow()
2) You're calling the open() method on loading of the page which will create a new browser window.
3) The call to openWindow in the link passes a value, yet the function is not written to receive one. (Not that this will affect the working in this case)
4) This code won't create a true popup window, it'll only create a new browser window - is that what you're after? Check out the createPopup() method of the window object for more info.

HTH,

Mark.
 
1. Add this to the 3rd parameter of window.open() -
location=no,scrollbars=no,menubar=no,toolbar=no,status=no

2. Remove all spaces there, so it'll be like this:
&quot;width=180,height=180,left=800,menubar=no,toolbar=no,status=no&quot;

3. You shouldn't write &quot;javascrirt:&quot; in any event handler calls:
<body onLoad=&quot;openWindow('popup.html')&quot;>
But, it's needed here:
<a href=&quot;javascript:eek:penWindow('remote.html')&quot;>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top