PDA

View Full Version : Looking for a script


Angel
04-30-2000, 06:02 AM
hello, I need a script that does the following:

opens a window upon exit but only if the user does not click a button that leads them to the same place...

can such a thing be done? and where can i find it.

thanks

Owen_MC_Evans
04-30-2000, 12:15 PM
This can be done with the following JavaScript
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>
&lt;Script language="JavaScript"&gt;
&lt;!--
function openWin(loc,win){
set done = document.donef.done.value;
if done &lt;&gt; "true" {
window.open(loc,win)
done = "true"
}
// -&gt;
&lt;/SCRIPT&gt;
[/code]
now then some where you will have to insert the following which cantains a variable set when the document carries out the window opening the code is as follows
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>
&lt;Form name = "donef"&gt;
&lt;input type="hidden" name = "done" value="false"&gt;
&lt;/FORM&gt;
[/code]
then you have to set up the code for the linking button

within the button code insert the following
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>
onclick="openWin("The_Location_of_The_Page.htm","")";
[/code]
and now you need to add the following in the body satement
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>
onUnload="openWin("The_Location_of_The_Page.htm","")";
[/code]
this should work!

Owen



[This message has been edited by Owen_MC_Evans (edited 04-30-2000).]