Results 1 to 4 of 4
  1. #1
    Tom Mortimer is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

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

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    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.

  3. #3
    Tom Mortimer is offline Member
    Join Date
    Mar 2011
    Posts
    2
    Rep Power
    0

    Default am very new to this

    Thanks I'll try that forum!

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •