HTML & WEB-Design

Moderators: Jonathan
Number of threads: 1249
Number of posts: 3348

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Redirect to another page if no activity? Posted by cybrpuhnk on 27 Jan 2002 at 8:06 PM
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
Report
Re: Redirect to another page if no activity? Posted by paulfp on 2 Feb 2002 at 12:14 PM
erm, something like this might work...?

<script>
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;
}
</script>
<body onLoad ="setTimeOut('decide();', 6000");">

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

Report
Re: Redirect to another page if no activity? Posted by paulfp on 2 Feb 2002 at 12:16 PM
ooooooops! just noticed a typo, sorry!

it should be

javascript:void(0);

: erm, something like this might work...?
:
: <script>
: 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;
: }
: </script>
: <body onLoad ="setTimeOut('decide();', 6000");">
:
: 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
:
:

Report
Re: Redirect to another page if no activity? Posted by cybrpuhnk on 2 Feb 2002 at 6:34 PM
Great! thank you.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.