Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 13th Jun 2012, 04:08 PM   #1
Warrior Member
 
Join Date: 2012
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Pop-Up Question-Please Help
Share on: 
fb share twitter share gplus share more share

Hello everyone,

I have a page that i included this code

<script type="text/javascript" language="javascript">

function exit() {
window.open('');
}
-->
</script>


<body onunload="exit()">

So, when someone exit from my page the pop up will appear. However, i have also one more link on that page and when i click
that link the pop up appear as well.
I do not want the pop up to appear when i click any other links on that page. I want the pop up to appear only when i click to exit from the page.

Anybody knows any solutions?

Thank you
chris100 is offline  
Unread 13th Jun 2012, 07:56 PM   #2
Kevin Cornbower
War Room Member
 
flashisland's Avatar
 
Join Date: 2011
Location: Florida
Posts: 61
Thanks: 6
Thanked 62 Times in 12 Posts
Default
Re: Pop-Up Question-Please Help
Share on: 
fb share twitter share gplus share more share

If you're using jQuery, it's pretty easy.

Code:
<script type="text/javascript">
     function PopIt() { return "Are you sure you want to leave?"; }
     function UnPopIt()  { /* nothing to return */ } 
 
     $(document).ready(function() {
     	window.onbeforeunload = PopIt;
	$("a").click(function(){ window.onbeforeunload = UnPopIt; });
     });
</script>
Code is from A Working Exit Popup ยป KBeezie.
flashisland is offline  
Unread 14th Jun 2012, 03:15 AM   #3
Active Warrior
 
Join Date: 2012
Posts: 49
Thanks: 0
Thanked 2 Times in 1 Post
Default
Re: Pop-Up Question-Please Help
Share on: 
fb share twitter share gplus share more share

Hi Friend,

Call the same function exit() on the that link
<element onclick="SomeJavaScriptCode">
e.g. <a href="#" onclick="return exit()">

Hope this will help you.
eluminousdev is offline  
Closed Thread


Bookmarks

Tags
pop, popup, question, questionplease


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 09:30 AM.