Prikazi cijelu temu 13.02.2015 14:11
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Lokacija:Tuzla


Predmet:Simulira kisu na stranici
PreuzmiIzvorni kôd (HTML):
  1. <TITLE>Pada kisa</TITLE>
  2. </HEAD>
  3.  
  4. <SCRIPT LANGUAGE="JavaScript">
  5. <!-- Begin
  6. var no = 50;
  7. var speed = 1;
  8. var ns4up = (document.layers) ? 1 : 0;
  9. var ie4up = (document.all) ? 1 : 0;
  10. var s, x, y, sn, cs;
  11. var a, r, cx, cy;
  12. var i, doc_width = 800, doc_height = 600;
  13. if (ns4up) {
  14. doc_width = self.innerWidth;
  15. doc_height = self.innerHeight;
  16. }
  17. else
  18. if (ie4up) {
  19. doc_width = document.body.clientWidth;
  20. doc_height = document.body.clientHeight;
  21. }
  22. x = new Array();
  23. y = new Array();
  24. r = new Array();
  25. cx = new Array();
  26. cy = new Array();
  27. s = 8;
  28. for (i = 0; i < no; ++ i) {
  29. initRain();
  30. if (ns4up) {
  31. if (i == 0) {
  32. document.write("<layer name=\"dot"+ i +"\" left=\"1\" ");
  33. document.write("top=\"1\" visibility=\"show\"><font color=\"blue\">");
  34. document.write(",</font></layer>");
  35. }
  36. else {
  37. document.write("<layer name=\"dot"+ i +"\" left=\"1\" ");
  38. document.write("top=\"1\" visibility=\"show\"><font color=\"blue\">");
  39. document.write(",</font></layer>");
  40.   }
  41. }
  42. else
  43. if (ie4up) {
  44. if (i == 0) {
  45. document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
  46. document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
  47. document.write("visible; TOP: 15px; LEFT: 15px;\"><font color=\"blue\">");
  48. document.write(",</font></div>");
  49. }
  50. else {
  51. document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
  52. document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
  53. document.write("visible; TOP: 15px; LEFT: 15px;\"><font color=\"blue\">");
  54. document.write(",</font></div>");
  55.      }
  56.   }
  57. }
  58. function initRain() {
  59. a = 6;
  60. r[i] = 1;
  61. sn = Math.sin(a);
  62. cs = Math.cos(a);
  63. cx[i] = Math.random() * doc_width + 1;
  64. cy[i] = Math.random() * doc_height + 1;
  65. x[i] = r[i] * sn + cx[i];
  66. y[i] = cy[i];
  67. }
  68. function makeRain() {
  69. r[i] = 1;
  70. cx[i] = Math.random() * doc_width + 1;
  71. cy[i] = 1;
  72. x[i] = r[i] * sn + cx[i];
  73. y[i] = r[i] * cs + cy[i];
  74. }
  75. function updateRain() {
  76. r[i] += s;
  77. x[i] = r[i] * sn + cx[i];
  78. y[i] = r[i] * cs + cy[i];
  79. }
  80. function raindropNS() {
  81. for (i = 0; i < no; ++ i) {
  82. updateRain();
  83. if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >= (doc_height - 20))) {
  84. makeRain();
  85. doc_width = self.innerWidth;
  86. doc_height = self.innerHeight;
  87. }
  88. document.layers["dot"+i].top = y[i];
  89. document.layers["dot"+i].left = x[i];
  90. }
  91. setTimeout("raindropNS()", speed);
  92. }
  93. function raindropIE() {
  94. for (i = 0; i < no; ++ i) {
  95. updateRain();
  96. if ((x[i] <= 1) || (x[i] >= (doc_width - 20)) || (y[i] >= (doc_height - 20))) {
  97. makeRain();
  98. doc_width = document.body.clientWidth;
  99. doc_height = document.body.clientHeight;
  100. }
  101. document.all["dot"+i].style.pixelTop = y[i];
  102. document.all["dot"+i].style.pixelLeft = x[i];
  103. }
  104. setTimeout("raindropIE()", speed);
  105. }
  106. if (ns4up) {
  107. raindropNS();
  108. }
  109. else
  110. if (ie4up) {
  111. raindropIE();
  112. }
  113. //  End -->
  114. </body>
  115. <font face="Tahoma">Pade kisa ubi misa</font>
  116. </BODY>
  117. </HTML>

Podrška samo putem foruma, jer samo tako i ostali imaju koristi od toga.