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

Open window

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am new to JavaScripts and I would really appreciate your help. I am using the following script on my site (econlinks.com) to have a window open when a user clicks on a link (and when the user clicks on some other link, I would like to have the same window open again):

function wintwo(url)
{
win = window.open(url,"wintwo","toolbar=yes,menubar=yes,location=no,status=yes,scrollbars=yes,resizable=yes,width=635,height=340,screenX=0,screenY=0,left=0,top=0");
if (win != null)
if (!win.closed);
win.focus();
}

One of my machines is giving me an error message. Is this code correct? Should there be a "!" before win.closed? Thanks for your response.

Fweb
 
I think I finally figured it out:

var win = null;

function wintwo(url) {
win = window.open(url,"secondwin","toolbar=yes,menubar=yes,location=no,status=yes,scrollbars=yes,resizable=yes,width=635,height=340,screenX=0,screenY=0,left=0,top=0");
win.focus();
}

function eradic8(url) {
if (win != null && win.open) win.close();
}

I also added:

<body ... onUnload=&quot;eradic8()&quot;>

NEW QUESTION: Is &quot;win.focus&quot; working with all versions of IE? If not, should I adjust the code somehow? Thanks again.

Fweb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top