Results 1 to 4 of 4
Thread: Problem with onmousemove
- 03-08-2011, 05:25 PM #1
Member
- Join Date
- Mar 2011
- Posts
- 2
- Rep Power
- 0
Problem with onmousemove
I have a script to auto-advance through a sequence of web pages. Each page has one large image, 4 links and some text. My desire is to advance to the next linked page every six seconds UNLESS the mouse is moved, then the wait delay is reset to 30 seconds. The script below works almost as I would like...
The PROBLEM I am having with the script is that if the mouse cursor is left on top of the image on the page, then the advances remain at 30 seconds. I suspect that the action of loading a new image onto the static mouse pointer is interpreted as a "mousemove." (If the mouse pointer is not on the image position, then the new pages are loaded every six seconds, unless the mouse is moved. The mouse must remain static for 30 seconds to enable the next page load.)
The FIX I need is for the auto page load to work as desired regardless of whether or not the mouse pointer is on the image or not.
Thanks for any help!
EXAMPLE script from a typical html page:
<script type="text/javascript">
var timer;
function proceed () {
location.href = 'Allanite%20sheet.html';
}
window.onload = function() {
timer = setTimeout(proceed, 6000);
};
</script>
<script type="text/javascript">
document.onmousemove = function() {
clearTimeout(timer);
setTimeout(proceed, 30000);
};
</script>
-
This has nothing to do with Java but rather is JavaScript. You know of course that they are as similar as ham is to hamster. I suggest you Google for a JavaScript forum and ask your question there.
- 03-08-2011, 05:33 PM #3
Member
- Join Date
- Mar 2011
- Posts
- 2
- Rep Power
- 0
am very new to this
Thanks I'll try that forum!
-
Sounds good. Let me lock this thread then.


LinkBack URL
About LinkBacks

Bookmarks