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

New Problem , close window and than open popup ??

Status
Not open for further replies.

iketutg

Programmer
Jul 21, 2003
3
ID
Hello everyone ,
I have new problem about popup, this is condition
if i click test 2, test 3, must be open popup.
if i click test 1 not open popup ( i want like this ) but
if i have much link in all pages and i must put (onclick="javascript:exit=false;leave()") every link all pages,

Please solution or other techniques for this problem ,

Thank's

---------------------
<html>
<head>
<title></title>
<script language=&quot;JavaScript&quot;>
<!--
var exit=true;
function leave()
{
if (exit)
open(&quot;popup/popupexit.htm&quot;,
'xXexit','location=0,menubar=0,toolbar=0,person albar=0,status=0,scrollbar=0,width=531,height=500,top=0,left=0');
}
// -->
</script>
</head>
<body leftmargin=&quot;0&quot; topmargin=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; onunload=&quot;leave()&quot;>
<br>
<a href=test1.html onclick=&quot;javascript:exit=false;leave()&quot;>test 1</a>
<a href=test2.html>test 2</a>
<a href=test3.html>test 3</a>

</body>
</html>
------------------------
 
As per last time - thread216-609185 - there is a very simple solution. One that, in fact, doesn't require any coding at all.

Don't Use Popups.


Unless you have a valid reason - for example a dialog box - and the popup is triggered by a user action - ie they click on the link that reads &quot;click here to open popup window&quot;. Just don't use them. They are at best unnecessary - at worst downright rude. I'm getting the feeling that, since you want to load the popup window when the user leaves your site, yours are tending toward the rude end of the scale.

As I said in the last thread. There is no way for the browser to distinguish exactly how the page is being unloaded. The onunload event is triggered whenever any of the following things occur:
The user closes the current browser window.
The user navigates to another location by entering a new address or selecting a Favorite.
The user clicks the Back, Forward, Refresh, or Home button.
The user clicks on an anchor that refers the browser to another Web page.
A script in the page invokes the anchor click method.
A script in the page invokes the document write method.
A script in the page invokes the document open method.
A script in the page invokes the document close method.
A script in the page invokes the window close method.
A script in the page invokes the window open method, providing the possible value _self for the window name.
A script in the page invokes the window navigate or NavigateAndFind method.
A script in the page invokes the location replace method.
A script in the page invokes the location reload method.
A script in the page specifies a new value for the location href property.
A script in the page submits a form to the address specified in the ACTION attribute via the INPUT type=submit control, or invokes the submit method.

And probably a few more.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top