home *** CD-ROM | disk | FTP | other *** search
/ PC User 2005 May / CD / PCU0505CD.iso / software / full / coffecup / files / html2005.exe / %MAINDIR% / Javascript / HowLong.xml < prev    next >
Encoding:
Text File  |  2005-02-16  |  1.3 KB  |  48 lines

  1. <ccResource>
  2.   <ccTitle>
  3. How Long
  4.   </ccTitle>
  5.   <ccCategory>
  6. Clocks
  7.   </ccCategory>
  8.   <ccDescription>
  9. This will pop up a message and tell the user how long they have been on your site.
  10.   </ccDescription>
  11.   <ccInstructions>
  12. Place the top part of the script above the HEAD tag. Place the bottom part with the link in the body of your webpage.  Make sure you include the onLoad function in your BODY tag.
  13.   </ccInstructions>
  14.   <ccHeadContent>
  15.   <SCRIPT LANGUAGE="JAVASCRIPT">
  16. //Modified by CoffeeCup Software 
  17. //This code is Copyright (c) 1998 CoffeeCup Software 
  18. //All rights reserved. License is granted to a single user to 
  19. //reuse this code on a personal or business Web Site.
  20.  function time_arrived() {
  21.     enter=new Date();
  22.  }
  23.  function time_here() {
  24.     exit=new Date();
  25.     time=(exit.getTime()-enter.getTime())/1000;
  26.     time=Math.round(time);
  27.     alert ("You have been here for " + time + " seconds.  Getting tired?")
  28.  }
  29.  </SCRIPT>
  30.   </ccHeadContent>
  31.   <ccBodyContent>
  32.  
  33. <CENTER>
  34. <FORM>
  35. <INPUT type="button" name="timehere" value="You have been here for..." onClick='time_here()'>
  36. </FORM>
  37. </CENTER>
  38.   </ccBodyContent>
  39.   <ccElementContent>
  40.   
  41.    <ccElementName>onLoad</ccElementName>
  42.    <ccElementAction>time_arrived()</ccElementAction>
  43.    
  44.   </ccElementContent>
  45.   <ccExtraData>
  46.  
  47.   </ccExtraData>
  48. </ccResource>