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

  1. <ccResource>
  2.   <ccTitle>
  3. OnOff Screen
  4.   </ccTitle>
  5.   <ccCategory>
  6. Browser
  7.   </ccCategory>
  8.   <ccDescription>
  9. This will make your background colors change upon button-click.
  10.  
  11.   </ccDescription>
  12.   <ccInstructions>
  13. Place this script in the HEAD tags of your webpage.  Then place the button in your web page.  When someone clicks it, the web page background colors will blink.
  14.  
  15. To change the color of the blinking background, alter the color-hex tag in the 'function blinkOn' section.  This is the very first section of the JavaScript. 
  16.   </ccInstructions>
  17.   <ccHeadContent>
  18.   <SCRIPT LANGUAGE="JavaScript">
  19. function blinkOn(){
  20.         theWin.document.bgColor = "#000000"
  21.         nTimes++
  22.         CCTimeOutID = window.setTimeout("blinkOff()",250);
  23. }
  24.  
  25. function blinkOff(){
  26.         theWin.document.bgColor = "FFFFFF"
  27.         if (nTimes < 5)
  28.                 CCTimeOutID = window.setTimeout("blinkOn()",250);
  29.         else theWin.history.go(0)
  30. }
  31.  
  32.  
  33. function blinkCC(aWin)
  34. {
  35.         nTimes = 0
  36.         theWin = aWin
  37.         CCTimeOutID = window.setTimeout("blinkOn()",250);
  38. }
  39. </SCRIPT>
  40.   </ccHeadContent>
  41.   <ccBodyContent>
  42. <CENTER><FORM>
  43. <INPUT TYPE="BUTTON" VALUE="On/Off Switch" onClick="blinkCC(self)">
  44. </FORM></CENTER>
  45.   </ccBodyContent>
  46.   <ccElementContent>
  47.   
  48.    <ccElementName></ccElementName>
  49.    <ccElementAction></ccElementAction>
  50.    
  51.   </ccElementContent>
  52.   <ccExtraData>
  53.  
  54.   </ccExtraData>
  55. </ccResource>