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

  1. <ccResource>
  2.   <ccTitle>
  3. Fireworks
  4.   </ccTitle>
  5.   <ccCategory>
  6. Browser
  7.   </ccCategory>
  8.   <ccDescription>
  9. Produces a multi-colored fireworks display as the background of the page. Works in both Netscape and Internet Explorer.
  10.  </ccDescription>
  11.   <ccInstructions>
  12. Copy the coding into the BODY of your HTML document
  13.     </ccInstructions>
  14.   <ccHeadContent>
  15.   
  16.   </ccHeadContent>
  17.   <ccBodyContent>
  18. <layer name="a0" left=10 top=10 visibility=show bgcolor="#ffffff" clip="0,0,1,1"></layer>
  19. <layer name="a1" left=10 top=10 visibility=show bgcolor="#fff000" clip="0,0,1,1"></layer>
  20. <layer name="a2" left=10 top=10 visibility=show bgcolor="#ffa000" clip="0,0,1,1"></layer>
  21. <layer name="a3" left=10 top=10 visibility=show bgcolor="#ff00ff" clip="0,0,1,1"></layer>
  22. <layer name="a4" left=10 top=10 visibility=show bgcolor="#00ff00" clip="0,0,1,1"></layer>
  23. <layer name="a5" left=10 top=10 visibility=show bgcolor="#ff00ff" clip="0,0,1,1"></layer>
  24. <layer name="a6" left=10 top=10 visibility=show bgcolor="#ff0000" clip="0,0,1,1"></layer>
  25. <layer name="a7" left=10 top=10 visibility=show bgcolor="#ffffff" clip="0,0,1,1"></layer>
  26. <layer name="a8" left=10 top=10 visibility=show bgcolor="#fff000" clip="0,0,1,1"></layer>
  27. <layer name="a9" left=10 top=10 visibility=show bgcolor="#ffa000" clip="0,0,1,1"></layer>
  28. <layer name="a10" left=10 top=10 visibility=show bgcolor="#ff00ff" clip="0,0,1,1"></layer>
  29. <layer name="a11" left=10 top=10 visibility=show bgcolor="#00ff00" clip="0,0,2,2"></layer>
  30. <layer name="a12" left=10 top=10 visibility=show bgcolor="#0000ff" clip="0,0,2,2"></layer>
  31. <layer name="a13" left=10 top=10 visibility=show bgcolor="#ff0000" clip="0,0,2,2"></layer>
  32. <div id="starsDiv" style="position:absolute;top:0px;left:0px">
  33. <div style="position:relative;width:2px;height:2px;background:#ffffff;font-size:2px"></div>
  34. <div style="position:relative;width:1px;height:1px;background:#fff000;font-size:1px"></div>
  35. <div style="position:relative;width:1px;height:1px;background:#ffa000;font-size:1px"></div>
  36. <div style="position:relative;width:1px;height:1px;background:#ff00ff;font-size:1px"></div>
  37. <div style="position:relative;width:1px;height:1px;background:#00ff00;font-size:1px"></div>
  38. <div style="position:relative;width:1px;height:1px;background:#0000ff;font-size:1px"></div>
  39. <div style="position:relative;width:1px;height:1px;background:#FF0000;font-size:1px"></div>
  40. <div style="position:relative;width:1px;height:1px;background:#ffffff;font-size:1px"></div>
  41. <div style="position:relative;width:1px;height:1px;background:#fff000;font-size:1px"></div>
  42. <div style="position:relative;width:1px;height:1px;background:#ffa000;font-size:1px"></div>
  43. <div style="position:relative;width:1px;height:1px;background:#ff00ff;font-size:1px"></div>
  44. <div style="position:relative;width:2px;height:2px;background:#ff00ff;font-size:2px"></div>
  45. <div style="position:relative;width:1px;height:1px;background:#0000ff;font-size:1px"></div>
  46. <div style="position:relative;width:1px;height:1px;background:#FF0000;font-size:1px"></div>
  47. </div>
  48.  
  49. <SCRIPT LANGUAGE="JavaScript">
  50. <!-- Begin
  51. var Clrs = new Array(9);
  52. Clrs[0] = 'ff0000';
  53. Clrs[1] = '00ff00';
  54. Clrs[2] = '000aff';
  55. Clrs[3] = 'ff00ff';
  56. Clrs[4] = 'ffa500';
  57. Clrs[5] = 'ffff00';
  58. Clrs[6] = '00ff00';
  59. Clrs[7] = 'ffffff';
  60. Clrs[8] = 'fffff0';
  61. var sClrs = new Array(5);
  62. sClrs[0] = 'ffa500';
  63. sClrs[1] = '55ff66';
  64. sClrs[2] = 'AC9DFC';
  65. sClrs[3] = 'fff000';
  66. sClrs[4] = 'fffff0';
  67. var yBase;
  68. var xBase;
  69. var step;
  70. var currStep = 0;
  71. var Xpos = 1;
  72. var Ypos = 1;
  73. var initialStarColor = 'ffa000';
  74. var Mtop = 250;
  75. var Mleft = 250;
  76. function Fireworks() {
  77. if (document.all) {
  78. yBase = window.document.body.offsetHeight / 3;
  79. xBase = window.document.body.offsetWidth / 8;
  80. }
  81. else if (document.layers) {
  82. yBase = window.innerHeight / 3;
  83. xBase = window.innerWidth / 8;
  84. }
  85. if (document.all) {
  86. step = 5;
  87. for ( i = 0 ; i < starsDiv.all.length ; i++ ) {
  88. for (ai = 0; ai < Clrs.length; ai++) {
  89. var c = Math.round(Math.random()*[ai]);
  90. }
  91. if (currStep < 90)
  92. starsDiv.all[i].style.background=initialStarColor;
  93. if (currStep > 90)
  94. starsDiv.all[i].style.background=Clrs[c];
  95. starsDiv.all[i].style.top = Mtop + yBase*Math.sin((currStep+i*5)/3)*Math.sin(550+currStep/100)
  96. starsDiv.all[i].style.left = Mleft + yBase*Math.cos((currStep+i*5)/3)*Math.sin(550+currStep/100)
  97.    }
  98. }
  99. else if (document.layers) {
  100. step = 5;
  101. for ( j = 0 ; j < 14 ; j++ ) { //number of NS layers!
  102. var templayer = "a"+j;
  103. for (ai = 0; ai < Clrs.length; ai++) {
  104. var c = Math.round(Math.random()*[ai]);
  105. }
  106. if (currStep < 90)
  107. document.layers[templayer].bgColor=initialStarColor;
  108. if (currStep > 90)
  109. document.layers[templayer].bgColor=Clrs[c];
  110. document.layers[templayer].top = Mtop + yBase*Math.sin((currStep+j*5)/3)*Math.sin(550+currStep/100)
  111. document.layers[templayer].left = Mleft + yBase*Math.cos((currStep+j*5)/3)*Math.sin(550+currStep/100)
  112.    }
  113. }
  114. currStep+= step;
  115. T=setTimeout("Fireworks()",5);
  116. if (currStep == 220) {
  117. currStep = -10;
  118. for (n = 0; n < sClrs.length; n++) {
  119. var k = Math.round(Math.random()*n);
  120. }
  121. initialStarColor = sClrs[k];
  122. if (document.all) {
  123. Dtop = window.document.body.clientHeight - 250;
  124. Dleft = xBase * 3.5;
  125. Mtop = Math.round(Math.random()*Dtop);
  126. Mleft = Math.round(Math.random()*Dleft);
  127. document.all.starsDiv.style.top = Mtop+document.body.scrollTop;
  128. document.all.starsDiv.style.left = Mleft+document.body.scrollLeft;
  129. }
  130. else if (document.layers) {
  131. Dleft = window.innerWidth - 100;
  132. Dtop = window.innerHeight - 100;
  133. Mtop = Math.round(Math.random()*Dtop+window.pageYOffset);
  134. Mleft = Math.round(Math.random()*Dleft+window.pageXOffset);
  135. document.layers[templayer].top = Mtop;
  136. document.layers[templayer].left = Mleft;
  137. }
  138. if ((Mtop < 20) || (Mleft < 20)) {
  139. Mtop += 90;
  140. Mleft += 90;
  141.       } 
  142.    }
  143. }
  144. Fireworks();
  145. //  End -->
  146. </script>
  147.  
  148.  
  149.   </ccBodyContent>
  150.   <ccElementContent>
  151.   
  152.    <ccElementName></ccElementName>
  153.    <ccElementAction></ccElementAction>
  154.    
  155.   </ccElementContent>
  156.   <ccExtraData>
  157.  
  158.   </ccExtraData>
  159. </ccResource>