Page 1 of 1

TimePage BBCode

Posted: 05 Mar 2010, 13:42
by BBCode Bot
TimePage BBCode

Author: Morpheus (alias djgalix)
Description: The TimePage BBCode display an alert box when you leave this page
[valid][/valid]

BBCode:

Code: Select all

[timepage][/timepage]
HTML:

Code: Select all

<script type="text/javascript">
NavName = navigator.appName.substring(0,3);
NavVersion = navigator.appVersion.substring(0,1);
if (NavName != "Mic" || NavVersion>=4)
   {
   entree = new Date;
   entree = entree.getTime();
   }
function esortTemp()
   {
   if (NavName != "Mic" || NavVersion>=4)
      {
      sortie = new Date;
sortie = sortie.getTime();
      secondes = Math.floor((sortie-entree)/1000);
      minutes = Math.floor(secondes/60);
      while (secondes>=60)
         {
         secondes = secondes-60;
         }
      alert('You were connected ' + minutes + ' minute(s) and ' + secondes + ' seconde(s) on this page!')      }
   }
window.onunload = esortTemp
</script>
Helpline:

Code: Select all

Timepage: [timepage][/timepage]
Example:

Code: Select all

[timepage][/timepage]
Demo:
[timepage][/timepage]
(you will see when you leave this page)