Page Timer Redirects User

[Total: 0    Average: 0/5]

This will set a timer to start on the page load event.

Head Code:

<style type="text/css">
a:link { text-decoration:none; font-weight:bold; color:#FFFF00; }
a:visited { text-decoration:none; font-weight:bold; color:#FFFF00; }
a:hover { font-weight:bold; color:#FF0000;  }
.wrap {
  background-color: white;
  border-width : 1px;
  border-color : #0000CC;
  border-style : solid;
}
.body { margin: 0px; padding: 0px; background-color: #FFFFFF; color: #004488; font-weight: normal; border-width: 0px; border-style: solid; border-color: #A0D3FF;}
</style>
<script language="JavaScript" type="text/javascript">
var Counter = 20; /* seconds to wait */
var AFTER_URL="http://js-x.com/"; /* where to send the user when the time expires */
var TIME=1*1000; /* 1 second */
var TIMER=null;
function stop()
{
  if(TIMER)
  {
    clearInterval(TIMER);
    TIMER=null;
  }
}
function start()
{
  stop();
  TIMER=setInterval("click()",TIME);
}
function click()
{
  if(!document.formular.pause.checked)
  {
    if ((document.formular.count.value=Counter--)<0)
    {
      stop();
    }
    if (!Counter)
    {
      document.location=AFTER_URL;
    }
  }
}
function initThis()
{
  start();
  document.formular.pause.checked=false;
}
</script>

Init Code:

initThis();

Body Code:

<form name="formular">
<table class=wrap align=center border="0" cellpadding=3 cellspacing=0>
<tr class=body>
<td>Wait for <input class=body type="text" name="count" size="2" >seconds.</td>
</tr>
<tr class=body>
<td>
<input type="checkbox" name="pause" value="ON">Pause Counter</td></tr>
</table>
</form>

Times Viewed: 4

Leave a Reply

Your email address will not be published. Required fields are marked *