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

  1. <ccResource>
  2.   <ccTitle>
  3. Site Alert
  4.   </ccTitle>
  5.   <ccCategory>
  6. Browser
  7.   </ccCategory>
  8.   <ccDescription>
  9. A simple login and password script
  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. var alertmessage="Welcome to CoffeeCup! \n http://www.coffeecup.com"
  21.  
  22. ///No editing required beyond here/////
  23.  
  24. //Alert only once per browser session (0=no, 1=yes)
  25. var once_per_session=1
  26.  
  27.  
  28. function get_cookie(Name) {
  29.   var search = Name + "="
  30.   var returnvalue = "";
  31.   if (document.cookie.length > 0) {
  32.     offset = document.cookie.indexOf(search)
  33.     if (offset != -1) { // if cookie exists
  34.       offset += search.length
  35.       // set index of beginning of value
  36.       end = document.cookie.indexOf(";", offset);
  37.       // set index of end of cookie value
  38.       if (end == -1)
  39.          end = document.cookie.length;
  40.       returnvalue=unescape(document.cookie.substring(offset, end))
  41.       }
  42.    }
  43.   return returnvalue;
  44. }
  45.  
  46. function alertornot(){
  47. if (get_cookie('alerted')==''){
  48. loadalert()
  49. document.cookie="alerted=yes"
  50. }
  51. }
  52.  
  53. function loadalert(){
  54. alert(alertmessage)
  55. }
  56.  
  57. if (once_per_session==0)
  58. loadalert()
  59. else
  60. alertornot()
  61.  
  62. </script>
  63.  
  64.   </ccBodyContent>
  65.   <ccElementContent>
  66.   
  67.    <ccElementName></ccElementName>
  68.    <ccElementAction></ccElementAction>
  69.    
  70.   </ccElementContent>
  71.   <ccExtraData>
  72.  
  73.   </ccExtraData>
  74. </ccResource>
  75.