java script question

  • assneck
  • Graduate
  • Graduate
  • User avatar
  • Posts: 195
  • Loc: seattle, wa

Post 3+ Months Ago

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
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Borrow -A- Geek
  • Professor
  • Professor
  • User avatar
  • Posts: 763
  • Loc: Dallas/Ft Worth, Texas

Post 3+ Months Ago

hmmm, post the url you are referring to so I/we can see the source...
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

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:
  • Borrow -A- Geek
  • Professor
  • Professor
  • User avatar
  • Posts: 763
  • Loc: Dallas/Ft Worth, Texas

Post 3+ Months Ago

edit: "yeah what he said ^^^^^ " lol good answer BigWebmaster
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9090
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

haha :lol:
  • assneck
  • Graduate
  • Graduate
  • User avatar
  • Posts: 195
  • Loc: seattle, wa

Post 3+ Months Ago

all fixed, thanks guys

assneck
  • dotcomUNDERGROUND
  • Born
  • Born
  • dotcomUNDERGROUND
  • Posts: 1

Post 3+ Months Ago

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
  • Posts: 1
  • Loc: Buffalo Wyoming USA

Post 3+ Months Ago

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 158 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.