View Single Post
Old 10-13-2005, 12:36 PM  
fetishblog
Confirmed User
 
Join Date: Sep 2005
Location: Your mom is my favorite pornstar!#%
Posts: 5,995
Code:
<SCRIPT LANGUAGE="JavaScript">
<!--begin

function popup(filename){
window.open(filename, "","height=300,width=300,top=0,left=0,location=no,menubar=no,
resizable=yes,scrollbars=no,status=no,titlebar=no,toolbar=no,directories=no");
}
// end -->
</SCRIPT>
To make the new window pop up on exit using the example code above, you simply add the following code to your body tag:

Code:
onUnload="popup('popup.html')"
Your body tag may therefore look like the following:

Code:
<body bgcolor="white" onUnload="popup('popup.html')">
As you can see by this code, we have set a variable to true, and then test that this variable is still true before the new window is displayed. If the variable is not true, the popup will simply not appear.

To enable this, we need to then add code to all the links and buttons, where if the user clicks them we do *not* want the popup to appear. Other links and buttons we just leave well alone.

This is the code we need:

Code:
onclick="exit=false;"
This sets the value of the exit variable to false, so that when the test on the variable runs, it will fail and the new window will not appear.

We add this code to the relevant tags for buttons and links as follows. Here's an example for a standard link:

Code:
<a href="purchase.html" onclick="exit=false;">Buy now!</a>
If you want to add the code to a button rather than a link, here's an example of how you should install the code:

Code:
<input type="button" value="Buy now!" onclick="exit=false;">
That's all there is to it. As always, make sure you test your web page before you upload it to your web site to make sure it works to your satisfaction.
__________________

Fling.com doesn't steal your traffic and sales unlike some other dating companies. I promote them, and so should you!
fetishblog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote