Код: <script language="javascript">
snow = True; // false-rain; true-snow
snowsym = "00" //These are the symbols for each
rainsym = " ' " //You can put images here.
howmany = 10 //How many drops/snowflakes?
if(snow){sym = snowsym; speed=1; angle=10; drops=howmany}
else{sym = rainsym; speed=30; drops=howmany; angle=6}
movex = -speed/angle; movey = speed; count = 0;
function moverain(){
for(move = 0; move < drops; move++){
xx[move]+=movex; yy[move]+=mv[move];
hmm = Math.round(Math.random()*1);
if(xx[move] < 0){xx[move] = maxx+10;}
if(yy[move] > maxy){yy[move] = 10;}
drop[move].left = xx[move]
drop[move].top = yy[move]+document.body.scrollTop;
}setTimeout('moverain()','1')}
</script>
<script language="javascript">
if (document.all){
drop = new Array(); xx = new Array(); yy = new Array(); mv = new Array()
ly = "document.all[\'"; st = "\'].style"
for(make = 0; make < drops; make++){
document.write('<div id="drop'+make+'" class=drop>'+sym+'</div>');
drop[make] = eval(ly+'drop'+make+st);
maxx = document.body.clientWidth-40
var height = document.body.clientHeight;
if ( document.documentElement.clientHeight > height ) {
height = document.documentElement.clientHeight;
}
maxy = height-40;
xx[make] = Math.random()*maxx;
yy[make] = -100-Math.random()*maxy;
drop[make].left = xx[make]
drop[make].top = yy[make]
mv[make] = (Math.random()*5)+speed/4;
drop[make].fontSize = (Math.random()*10)+20;
if(snow){col = 'white'}else{col = 'blue'}//if(snow) {col = 'white'} else {'YOUR COLOR'}
drop[make].color = col;
}
window.onload=moverain
}
</script>
Код: <SCRIPT TYPE="text/javascript">
/**
* You may use this code for free on any web page provided that
* these comment lines and the following credit remain in the code.
* Compact Cross Browser Ghosts effect by http://www.JavaScript-fx.com
*/
if(!window.JSFX) JSFX=new Object();
JSFX.ghostImages = new Array(
"<img src='http://images.freewebs.com/Images/Effects/ghost1.gif'>",
"<img src='http://images.freewebs.com/Images/Effects/ghost2.gif'>",
"<img src='http://images.freewebs.com/Images/Effects/ghost3.gif'>",
"<img src='http://images.freewebs.com/Images/Effects/ghost4.gif'>"
);
var ns4 = document.layers;
var ie4 = document.all;
JSFX.makeLayer = function(id)
{
var el = document.getElementById ? document.getElementById(id) :
document.all ? document.all[id] :
document.layers[id];
if(ns4) el.style=el;
el.sP=function(x,y){this.style.left = x;this.style.top=y;};
el.show=function(){ this.style.visibility = "visible"; }
el.hide=function(){ this.style.visibility = "hidden"; }
if(ns4 || window.opera)
el.sO = function(pc){return 0;};
else if(ie4)
el.sO = function(pc)
{
if(this.style.filter=="")
this.style.filter="alpha(opacity=100);";
this.filters.alpha.opacity=pc;
}
else
el.sO = function(pc){this.style.MozOpacity=pc/100;}
return el;
}
if(window.innerWidth)
{
gX=function(){return innerWidth;};
gY=function(){return innerHeight;};
}
else
{
gX=function(){return document.body.clientWidth-30;};
gY=function(){return document.body.clientHeight-30;};
}
JSFX.ghostOutput=function()
{
for(var i=0 ; i<JSFX.ghostImages.length ; i++)
document.write(ns4 ? "<LAYER NAME='gh"+i+"'>"+JSFX.ghostImages[i]+"</LAYER>" :
"<DIV id='gh"+i+"' style='position:absolute'>"+JSFX.ghostImages[i]+"</DIV>" );
}
JSFX.ghostSprites = new Array();
JSFX.ghostStartAni = function()
{
for(var i=0 ;i<JSFX.ghostImages.length;i++)
{
var el=JSFX.makeLayer("gh"+i);
el.x=Math.random()*gX();
el.y=Math.random()*gY();
el.tx=Math.random()*gX();
el.ty=Math.random()*gY();
el.dx=-5+Math.random()*10;
el.dy=-5+Math.random()*10;
el.state="off";
el.op=0;
el.sO(el.op);
el.hide();
JSFX.ghostSprites[i] = el;
}
setInterval("JSFX.ghostAni()", 40);
}
JSFX.ghostAni = function()
{
for(var i=0 ;i<JSFX.ghostSprites.length;i++)
{
el=JSFX.ghostSprites[i];
if(el.state == "off")
{
if(Math.random() > .99)
{
el.state="up";
el.show();
}
}
else if(el.state == "on")
{
if(Math.random() > .98)
el.state="down";
}
else if(el.state == "up")
{
el.op += 2;
el.sO(el.op);
if(el.op==100)
el.state = "on";
}
else if(el.state == "down")
{
el.op -= 2;
if(el.op==0)
{
el.hide();
el.state = "off";
}
else
el.sO(el.op);
}
var X = (el.tx - el.x);
var Y = (el.ty - el.y);
var len = Math.sqrt(X*X+Y*Y);
if(len < 1) len = 1;
var dx = 20 * (X/len);
var dy = 20 * (Y/len);
var ddx = (dx - el.dx)/10;
var ddy = (dy - el.dy)/10;
el.dx += ddx;
el.dy += ddy;
el.sP(el.x+=el.dx,el.y+=el.dy);
if(Math.random() >.95 )
{
el.tx = Math.random()*gX();
el.ty = Math.random()*gY();
}
}
}
JSFX.ghostStart = function()
{
if(JSFX.ghostLoad)JSFX.ghostLoad();
JSFX.ghostStartAni();
}
JSFX.ghostOutput();
JSFX.ghostLoad=window.onload;
window.onload=JSFX.ghostStart;
</script>
Взято с форума англоязычной версии конструктора ( own-free-website.com )
______________