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

  1. <ccResource>
  2.   <ccTitle>
  3. Refresh Timer          
  4.   </ccTitle>
  5.   <ccCategory>
  6. Browser
  7.   </ccCategory>
  8.   <ccDescription>
  9. This script will show the time the user has left before the page will refresh in the status bar. Only works in Internet Explorer 
  10.   </ccDescription>
  11.   <ccInstructions>
  12. The code goes only inside the BODY tags.  You can change the items below to suit your needs.
  13.   </ccInstructions>
  14.   <ccHeadContent>
  15.   
  16.   </ccHeadContent>
  17.   <ccBodyContent>
  18. <script>
  19.  
  20. //refresh time is in "minutes:seconds" 
  21. var timer="0:30"
  22.  
  23. if (document.images){
  24. var CoffeeParse=timer.split(":")
  25. CoffeeParse=CoffeeParse[0]*60+CoffeeParse[1]*1
  26. }
  27. function refreshtime(){
  28. if (!document.images)
  29. return
  30. if (CoffeeParse==1)
  31. window.location.reload()
  32. else{ 
  33. CoffeeParse-=1
  34. currentminutes=Math.floor(CoffeeParse/60)
  35. currentsec=CoffeeParse%60
  36. if (currentminutes!=0)
  37. currenttime=currentminutes+" minutes and "+currentsec+" seconds until page refresh!"
  38. else
  39. currenttime=currentsec+" seconds left until page refresh!"
  40. window.status=currenttime
  41. setTimeout("refreshtime()",1000)
  42. }
  43. }
  44.  
  45. window.onload=refreshtime
  46. //-->
  47. </script>
  48.  
  49.   </ccBodyContent>
  50.   <ccElementContent>
  51.   
  52.    <ccElementName></ccElementName>
  53.    <ccElementAction></ccElementAction>
  54.    
  55.   </ccElementContent>
  56.   <ccExtraData>
  57.  
  58.   </ccExtraData>
  59. </ccResource>
  60.