Redirect to another page if no activity?

I'm putting together a web presentation and I need to make one page go to the next after a set amount of time IF there has been no activity (mouse movement etc).
Thank you

Comments

  • erm, something like this might work...?


    var nothingsHappened = true //this is boolean, it'll go to false
    //when something happens

    document.onMouseMove = "nothingsHappened=false";
    document.onKeyPress = "nothingsHappened=false";

    function decide() {
    if (nothingsHappened==false)
    {
    moveMe("http://www.paulfp.co.uk/dzine");
    }
    else {
    javascriptLvoid(0);
    }
    }

    function moveMe(url) {
    window.location.href = url;
    }



    I haven't tested this, so the syntax might be slightly wrong but I think you'll get the general idea. Change 6000 to the number of milliseconds you want to wait (ie. 6000 is 6secs).

    hope this helps!

    God bless
    =====
    paulfp
    www.paulfp.co.uk/delirious

  • ooooooops! just noticed a typo, sorry!

    it should be

    javascript:void(0);

    : erm, something like this might work...?
    :
    :
    : var nothingsHappened = true //this is boolean, it'll go to false
    : //when something happens
    :
    : document.onMouseMove = "nothingsHappened=false";
    : document.onKeyPress = "nothingsHappened=false";
    :
    : function decide() {
    : if (nothingsHappened==false)
    : {
    : moveMe("http://www.paulfp.co.uk/dzine");
    : }
    : else {
    : javascriptLvoid(0);
    : }
    : }
    :
    : function moveMe(url) {
    : window.location.href = url;
    : }
    :
    :
    :
    : I haven't tested this, so the syntax might be slightly wrong but I think you'll get the general idea. Change 6000 to the number of milliseconds you want to wait (ie. 6000 is 6secs).
    :
    : hope this helps!
    :
    : God bless
    : =====
    : paulfp
    : www.paulfp.co.uk/delirious
    :
    :

  • Great! thank you.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories