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

open new window resultes in multiple opens

Status
Not open for further replies.

blexman

Programmer
Jul 18, 2001
34
0
0
CA
I am trying to open a new window without the toolbar and put the focus on field1. I would like to close the old window as well. What is currently happening is the new window is opening and I guess the onload event keeps oepening new widnows...etc. How do I stop multiple onloads ?

abc.asp

<HEAD>
<script type=&quot;text/javascript&quot;>
<!--
function win()
{
var x=window.open(&quot;abc.asp&quot;,&quot;x&quot;,&quot;toolbar=no&quot;);
document.frmabc.field1.focus();

}
//-->
</script>
</HEAD>
<LINK rel=&quot;stylesheet&quot; type=&quot;text/css&quot; ref=&quot;stylesheet.css&quot;>
<BODY onload=&quot;win()&quot;>


thanks
 
Change the function:

function win()
{
if (window.opener) {
document.frmabc.field1.focus();
} else
window.open(&quot;newspage.htm&quot;,&quot;x&quot;,&quot;toolbar=no&quot;);
}


Regards,
Sergey Smirnov
Ask me directly at:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top