Forum Moderators: open
I'm adding an exit popup that only appears when visitors leave my site. As such, I need to code all my internal links with onclick="exit=false"
That's easy enough, but I'm using a dropdown menu script (Ultimate Dropdown Menu) and I can't just code the links in the script. I e-mailed the developer and he sent this back as the proper format for coding the link:
("page.html?name=value&othername=othervalue")
I'm ignorant about how to translate this. He's a busy guy and takes a while to respond, so I thought I'd just ask you helpful folks. Can someone please take the onclick="exit=false" instruction and put it in the proper format for me?
Thanks very much in advance!
I think i see what it means but a little more info might be good. Do the links in the dropdown menu get fired by an onChange event or is there a button you click to GO to the link?
if it calls a function you may be able to put your exit=false into the function itself.
It's a DHTML dropdown menu, in which the user simply clicks the link name to go to that page.
Here's a bit more of the code from the script that shows how each page is linked:
// add main link item ("url","Link name",width,"text-alignment","_target","alt text",top position,left position)
addMainItem("index.html","Home",115,"center","","",0,0);
// define submenu properties (width,"align to edge","text-alignment",v offset,h offset)
defineSubmenuProperties(180,"left","left",0,0);
// add submenu link items ("url","Link name","_target","alt text")
// define child menu properties (width,"align to edge","text-alignment",v offset,h offset)
defineChildmenuProperties(170,"left","center",-3,-30);
// add child menu link items ("url","Link name","_target","alt text")
addMainItem("","Articles & Tips",103,"center","","",0,0);
defineSubmenuProperties(335,"left","left",0,0);
addSubmenuItem("info.html" ,"Articles Home","_self","");
addSubmenuItem("pages.html","From the Pages of Our Newsletter","_self","");
addSubmenuItem("ebooks.html","Free eBooks","_self","");
instead of
addMainItem("index.html","Home",115,"center","","",0,0);
put
addMainItem("index.html?exit=false","Home",115,"center","","",0,0);
i don't know if this fixes the problem but that is what he meant it seems, you just add ?exit=false to the end of each link in each item.
All the best,
Jon
The script is:
<script>
<!-- This Script Is Copyright © 2001 The -->
<!-- Effective Marketing Group - All Rights -->
<!-- Reserved. If you use this code, you -->
<!-- MUST include this copyright header. -->
function getCookie(NameOfCookie)
{
if (document.cookie.length > 0)
{
begin = document.cookie.indexOf(NameOfCookie+"=");
if (begin != -1)
{
begin += NameOfCookie.length+1;
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end));
}
}
return null;
}
function setCookie(NameOfCookie, value, expiredays)
{
var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime() + (expiredays*24*60*60*1000));
document.cookie = NameOfCookie + "=" + escape(value) +
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}
var exit=true;
function leave()
{
visited=getCookie('visited');
if (exit)
if (visited==null)
{
setCookie('visited','yes',1) // SET AMOUNT OF DAYS HERE
window.open('xpop.html','popup','location=no,toolbar=no,resizable=yes,scrollbars=yes,width=400,height=550');
}
}
</script>
And this is included in the <BODY> tag:
<BODY onUnload="leave()">
I have it set up on 404 error page -
<snip>
(edited by: Xoc at 8:37 pm (utc) on April 24, 2002)
this statement has problems as well, you have if (exit) but the braces would seem to be missing I would think it should be like this
function leave()
{
visited=getCookie('visited');
if (exit) {
if (visited==null)
{
setCookie('visited','yes',1) // SET AMOUNT OF DAYS HERE
window.open ('xpop.html','popup','location=no,toolbar=no,resizable=yes,scrollbars=yes,width=400,height=550');
}
}
}
then it would check if exited is true then set the cookie and show the popup