It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Javascript events

Javascript events

Postby dougyitbos on Mon Dec 22, 2008 7:32 pm

Hi folks...

I need to show a div when a visitor attempts to leave my page.

I've tried using "onMouseout" on a div.
I've also tried onbeforeunload, and onbeforeunload

These events are not behaving as I expected.
The div shows when a user leaves the page - but also when the page loads.
That's no good.

Also - in the case of "onMouseout" it fires when I try to take the mouse over to the scroll bar and scroll down. Also not good.

I Need something that only shows when the user is leaving - not arriving, or scrolling.

What event should I be using?

Keep in mind I don't want to STOP them... just show a div to warn them about leaving in a current state.

I want to avoid the window.open as showing a div isn't a "pop up" and thus not likely to be blocked.

Thanks!
Doug
dougyitbos
 
Posts: 0
Joined: Mon Dec 22, 2008 7:29 pm

Re: Javascript events

Postby rangana on Tue Dec 23, 2008 1:26 am

Apparently, the only event (as I'm quiet aware) that would help you in your desire is the "onbeforeunload" which runs when your user is trying to leave your page.

Unluckily, an odd dialog will be seen (as what you might have exprerience).
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines


Who is online

Users browsing this forum: No registered users and 5 guests