java script question

  • assneck
  • Graduate
  • Graduate
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 199
  • Loc: seattle, wa
  • Status: Offline

Post January 11th, 2003, 1:59 pm

ok, i have some links on my page that when clicked cannot have any popups popup. i have an exit popup so my question is what is the code that i can put in for those 6 links that will only stop the popup on those 6 links and not all the other links on my site?

thanks
assneck
Garbage Pail Kids BLOG
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post January 11th, 2003, 1:59 pm

  • Borrow -A- Geek
  • Professor
  • Professor
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 775
  • Loc: Dallas/Ft Worth, Texas
  • Status: Offline

Post January 11th, 2003, 3:02 pm

hmmm, post the url you are referring to so I/we can see the source...
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8934
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post January 11th, 2003, 3:07 pm

Okay I am assuming then that you initiate a popup when someone leaves your site by doing something as the following in your body tag

Code: [ Select ]
onunload="exit()"


That will call a function called exit(). Now goto the part of your javascript where it defines that exit function. It might look something like the following:

Code: [ Select ]
<script language="JavaScript">
<!--
function exit()
{
  open("http://www.somesite.com/");
}
//-->
</script>
  1. <script language="JavaScript">
  2. <!--
  3. function exit()
  4. {
  5.   open("http://www.somesite.com/");
  6. }
  7. //-->
  8. </script>


What you need to do is introduce an variable so that it is something like this:

Code: [ Select ]
<script language="JavaScript">
<!--
var popup=true;
function exit()
{
  if (popup)
  open("http://www.somesite.com/");
}
//-->
</script>
  1. <script language="JavaScript">
  2. <!--
  3. var popup=true;
  4. function exit()
  5. {
  6.   if (popup)
  7.   open("http://www.somesite.com/");
  8. }
  9. //-->
  10. </script>


Now with that, you can now set certain exit links to void out the popup. All you do is make a link that says "popup=false" and it will make so the popup will not happen. For example a normal link looks something like and will have the popup since its replacing the current page by not popping in a new window:

Code: [ Select ]
<a href="http://www.anothersite.com/" target="_top">Another Site</a>


To void the popup you would write a link as

Code: [ Select ]
<a href="http://www.anothersite.com/" target="_top" onClick="popup=false">Another Site</a>


Hope that solved your problem :shock:
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • Borrow -A- Geek
  • Professor
  • Professor
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 775
  • Loc: Dallas/Ft Worth, Texas
  • Status: Offline

Post January 11th, 2003, 3:10 pm

edit: "yeah what he said ^^^^^ " lol good answer BigWebmaster
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 8934
  • Loc: Seattle, WA & Phoenix, AZ
  • Status: Offline

Post January 11th, 2003, 3:14 pm

haha :lol:
Ozzu Hosting - Want your website on a fast server like Ozzu?
  • assneck
  • Graduate
  • Graduate
  • User avatar
  • Joined: Dec 20, 2002
  • Posts: 199
  • Loc: seattle, wa
  • Status: Offline

Post January 11th, 2003, 6:47 pm

all fixed, thanks guys

assneck
Garbage Pail Kids BLOG
  • dotcomUNDERGROUND
  • Born
  • Born
  • No Avatar
  • Joined: Aug 03, 2003
  • Posts: 1
  • Status: Offline

Post August 5th, 2003, 10:07 am

i have got the following code in my page

Code: [ Select ]
<BODY OnUnload="window.open('http://www.exxxitmoney.com/imps.php?c=pbd&lg=EN&l='+location)">


but i use PHP-Nuke and therefore i have to use this same code in every page and its not possible to use the onClick with every single link on the page.

so now i get popup whenever a use is going to a new page within my own site. every single click is resulting a popup which is just too much annoying and i am afraid of loseing visitors.

So i need something which will open the popup ONLY when the user LEAVES MY SITE. when he closes the browser window or moves to another site, not just another page on my own site

How can i do it? help please....
  • Marketing-Boys.Com
  • Born
  • Born
  • User avatar
  • Joined: Jun 24, 2004
  • Posts: 1
  • Loc: Buffalo Wyoming USA
  • Status: Offline

Post June 24th, 2004, 1:14 am

Can this be configged to pop up 90 seconds after the visitor leaves the page ?

Code: [ Select ]
onunload="exit()"


-- Thanx

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 122 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.