TimePage BBCode

05 Mar 2010, 11:42

TimePage BBCode

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




BBCode:
Code:
[timepage][/timepage]

HTML:
Code:
<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:
Timepage: [timepage][/timepage]

Example:
Code:
[timepage][/timepage]


Demo:

(you will see when you leave this page)