Loading:


Padający śnieg wersja zaawansowana

Skrypt wyświetla zaawansowaną wersję padającego śniegu na stronie.



Napisz Artyku³

Listing


<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-2">
<SCRIPT LANGUAGE= "JavaScript" type= "text/javascript">
<!-- Ukrycie przed przeglądarkami nie obsługującymi JavaScriptów
var speedTableY = new Array();
var posX = new Array();
var smooth = new Array();
var amplitude = new Array();
var tabB = new Array();
var speed = 50;
var speedLevelsY = 5;
var layersCount = 10;
function ustaw()
{
  clWidth = document.body.clientWidth - 50;
  for (i = 0; i < layersCount; i++){
    posX[i] = Math.ceil(Math.random() * clWidth);
    speedTableY[i] = Math.ceil(Math.random() * speedLevelsY);
    amplitude[i] = Math.ceil(Math.random() * 40 + 20);
    smooth[i] = Math.ceil(Math.random() * 48) + 10;
    tabB[i] = Math.random() * 4;
  }
}
var b = 0;
function start()
{
  clWidth = document.body.clientWidth - 50;
  clHeight = document.body.clientHeight;
  for (i = 0; i < layersCount; i++){
    y = parseInt(document.getElementById('el' + i).style.top);
    y += speedTableY[i];

    tabB[i] += Math.PI / smooth[i];
    x = parseInt(Math.sin(tabB[i]) * amplitude[i]) + posX[i];
    if (x >= clWidth){
      x = clWidth;
    }
    document.getElementById('el' + i).style.left = x;
   
    if (y >= clHeight - 45){
      y = -50;
      posX[i] = Math.ceil(Math.random() * clWidth);
      speedTableY[i] = Math.ceil(Math.random() * speedLevelsY);
      amplitude[i] = Math.ceil(Math.random() * 100 + 20);
      smooth[i] = Math.ceil(Math.random() * 48) + 48;
    }
    document.getElementById('el' + i).style.top = y;
  }
  setTimeout('start()', speed);
}
// Koniec kodu JavaScript -->
</SCRIPT>
</HEAD>
<BODY onLoad='ustaw();start();'>
<SCRIPT LANGUAGE= "JavaScript" type= "text/javascript">
<!-- Ukrycie przed przeglądarkami nie obsługującymi JavaScriptów
for (i = 0; i < layersCount; i++){
  str = '<DIV ID="el' + i + '" ';
  str += 'style = "visibility: visible; ';
  str += 'width=50px; ';
  str += 'heigth=45px; ';
  str += 'position: absolute; ';
  str += 'top: 1; ';
  str += 'left: 1;">';
  str += '<IMG SRC="sniezynka.gif">';
  str += '</DIV>';
  document.write(str);
}
//document.write('<H1 align="center">Treść strony<H1>');
// Koniec kodu JavaScript -->
</SCRIPT>
<H1 align="center">Treść strony<H1>
</BODY>
</HTML>
 




Dodano przez: igor
Ranga: Administrator serwisu Punktów: 28716
Komentarze użytkowników
    • Tre¶æ komentarza
      Kod do komentarza (opcjonalnie)
      PHP JavaScript MySQL Smarty SQL HTML CSS ActionScript
      Autor
      Token
      token

       

       








funkcje.net
Wszelkie prawa zastrzeżone©. | Funkcje.net 2008-2024 v.1.5 | design: diviXdesign & rainbowcolors