Guest Posted July 31, 2007 Share Posted July 31, 2007 I want to run a function when the mouse if off the page so I made a div that has the whole page in it and the div has a onmouseout function but when I go to mouseover certian things it still does it. This is what I want it like http://www.market-soft.com/eg/ This is what i got going http://caribongoflorida.com/ Can you help me Quote Link to comment Share on other sites More sharing options...
Karl33to Posted August 2, 2007 Share Posted August 2, 2007 Well, I don't know whether your still working on it at the moment, but I cant see anything happening at all on your site. If its of any help to you, the other site you mentioned works by tracking the cursor position rather than onmouseout, when the cursor gets to less than 20px from the top of the window it displays the message window. Quote Link to comment Share on other sites More sharing options...
Guest Posted August 2, 2007 Share Posted August 2, 2007 Thats exactly what im tring to do do you have any code that may help me achieve this? Quote Link to comment Share on other sites More sharing options...
php_tom Posted August 6, 2007 Share Posted August 6, 2007 Try this: <html> <head> <script type='text/javascript'> var x, y, winWidth, winHeight; function init() { getWinSize(); if (window.Event) { document.captureEvents(Event.MOUSEMOVE); } document.onresize = getWinSize; document.onmousemove = getXY; setInterval('check();', 1); } function getWinSize() { winWidth = document.body.clientWidth-2; winHeight = document.body.clientHeight-2; } function getXY(e) { x = (window.Event) ? e.pageX : event.clientX; y = (window.Event) ? e.pageY : event.clientY; } function check() { if((x<=1 || x>=winWidth) || (y<=1 || y>=winHeight)) alert('Off Page'); } </script> </head> <body onload='init();'> Your web page goes here...<br> </body> </html> Hope this helps some. Quote Link to comment Share on other sites More sharing options...
Guest Posted August 6, 2007 Share Posted August 6, 2007 That Helps so much thank you thank you thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.