Hello –
My goal is to have 1 popup show up when the user exits the site (on unload) and also allow other popup boxes to show up when the user clicks on the “about us” or “faq” links.
For some reason when the “about us” html link is clicked I get a script error. This started happening after I added the “on unload” popup.
This first chunk of code contains the reference to the “on unload” popup script, and then underneath has the popup script for clicked html links.
[COLOR=blue]<SCRIPT LANGUAGE=”javascript” SRC=”/popupscript.js”></SCRIPT>
<script language=”javascript”>
var newwindow;
function poptastic(url)
{
newwindow=window.open(url,’name’,’height=450,width=425,toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1′);
if (window.focus) {newwindow.focus()}
}
</script>
Next, here is the contents of the popupscript.js file (this is the script that opens the popup on unload if the varible OPEN = 1
[COLOR=blue]var open=1;
function openw()
{
open=1;
}
function unopen()
{
open=0;
return true;
}
function createwin()
{
if (open==1)
{
window.showModalDialog(“
}
}
Finally, here is the HTML code for the “about us” link which should open a popup using the “poptastic” code above.
[COLOR=blue]<a href=”javascript:poptastic(‘/sub/aboutus.htm’);” onclick=”return unopen();”>About
Us</a>
For some reason I get a javascript error when I click on the “about us” html link. The “on unload” popup works like a charm.
Are the windows clashing for some reason?
Any help would be greatly appreciated. Keep in mind that the “oncclick=return unopen{}” basically sets a flag so that the “on unload” popup won’t go.
Thanks much…
Dan