Advertisement
Guest User

asdasdasdasdsad

a guest
Dec 18th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.96 KB | None | 0 0
  1. <html>
  2. <body>
  3. <script type="text/javascript">
  4.  
  5. /******************************************
  6. * Snow Effect Script- By Altan d.o.o. (http://www.altan.hr/snow/index.html)
  7. * Visit Dynamic Drive DHTML code library (http://www.dynamicdrive.com/) for full source code
  8. * Last updated Nov 9th, 05' by DD. This notice must stay intact for use
  9. ******************************************/
  10. function openwindow(){
  11. window.open("autumn_effect.htm","","width=350,height=500")
  12. }
  13.  
  14. //Configure below to change URL path to the snow image
  15. var snowsrc="snow.gif"
  16. // Configure below to change number of snow to render
  17. var no = 10;
  18. // Configure whether snow should disappear after x seconds (0=never):
  19. var hidesnowtime = 0;
  20. // Configure how much snow should drop down before fading ("windowheight" or "pageheight")
  21. var snowdistance = "pageheight";
  22.  
  23. ///////////Stop Config//////////////////////////////////
  24.  
  25. var ie4up = (document.all) ? 1 : 0;
  26. var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
  27.  
  28. function iecompattest(){
  29. return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
  30. }
  31.  
  32. var dx, xp, yp; // coordinate and position variables
  33. var am, stx, sty; // amplitude and step variables
  34. var i, doc_width = 800, doc_height = 600;
  35.  
  36. if (ns6up) {
  37. doc_width = self.innerWidth;
  38. doc_height = self.innerHeight;
  39. } else if (ie4up) {
  40. doc_width = iecompattest().clientWidth;
  41. doc_height = iecompattest().clientHeight;
  42. }
  43.  
  44. dx = new Array();
  45. xp = new Array();
  46. yp = new Array();
  47. am = new Array();
  48. stx = new Array();
  49. sty = new Array();
  50. snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "snow.gif" : snowsrc
  51. for (i = 0; i < no; ++ i) {
  52. dx[i] = 0; // set coordinate variables
  53. xp[i] = Math.random()*(doc_width-50); // set position variables
  54. yp[i] = Math.random()*doc_height;
  55. am[i] = Math.random()*20; // set amplitude variables
  56. stx[i] = 0.02 + Math.random()/10; // set step variables
  57. sty[i] = 0.7 + Math.random(); // set step variables
  58. if (ie4up||ns6up) {
  59. if (i == 0) {
  60. document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><a href=\"http://dynamicdrive.com\"><img src='"+snowsrc+"' border=\"0\"><\/a><\/div>");
  61. } else {
  62. document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
  63. }
  64. }
  65. }
  66.  
  67. function snowIE_NS6() { // IE and NS6 main animation function
  68. doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
  69. doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")? iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
  70. if (snowdistance=="windowheight"){
  71. doc_height = window.innerHeight || iecompattest().clientHeight
  72. }
  73. else{
  74. doc_height = iecompattest().scrollHeight
  75. }
  76. for (i = 0; i < no; ++ i) { // iterate for every dot
  77. yp[i] += sty[i];
  78. if (yp[i] > doc_height-50) {
  79. xp[i] = Math.random()*(doc_width-am[i]-30);
  80. yp[i] = 0;
  81. stx[i] = 0.02 + Math.random()/10;
  82. sty[i] = 0.7 + Math.random();
  83. }
  84. dx[i] += stx[i];
  85. document.getElementById("dot"+i).style.top=yp[i]+"px";
  86. document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
  87. }
  88. snowtimer=setTimeout("snowIE_NS6()", 10);
  89. }
  90.  
  91. function hidesnow(){
  92. if (window.snowtimer) clearTimeout(snowtimer)
  93. for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
  94. }
  95.  
  96.  
  97. if (ie4up||ns6up){
  98. snowIE_NS6();
  99. if (hidesnowtime>0)
  100. setTimeout("hidesnow()", hidesnowtime*1000)
  101. }
  102.  
  103. </script>
  104. </body>
  105.  
  106. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement