Javascript.......does not work here(((
18-01-2006 13:49
к комментариям - к полной версии
- понравилось!
var butterflypath="butterfly.gif"; //configure path to butterfly image
var speed=200; //SPEED IN MILLISECONDS.
var change=800; //TIME BETWEEN DIRECTION CHANGES IN MILLISECONDS.
var xmax=15; //MAX NUMBER OF PIXEL STEPS LEFT OR RIGHT.
var ymax=15; //MAX NUMBER OF PIXEL STEPS UP OR DOWN.
var isNS=(navigator.appName=="Netscape");
var _all='all.';
var _style='.style';
var _visible='visible';
var w_x, w_y, x, y, tx, ty, xo, yo, img1;
var incrx=2;
var incry=8;
var xdir=true;
var ydir=true;
if(isNS){
_all='';
_style='';
_visible='show';
}
function init(){
img1=eval('document.'+_all+'img1'+_style);
resize();
moveimg(w_x/2,w_y/2);
img1.visibility=_visible;
animate();
changedirs();
regenerate2();
}
function resize(){
if(isNS){
w_x=window.innerWidth-document.img1.document.width;
w_y=window.innerHeight-document.img1.document.height;
}else{
w_x=document.body.clientWidth-document.image1.width;
w_y=document.body.clientHeight-document.image1.height;
}}
function changedirs(){
xdir=(Math.floor(Math.random()*2)==0);
ydir=(Math.floor(Math.random()*2)==0);
incrx=Math.floor(Math.random()*xmax);
incry=Math.floor(Math.random()*ymax);
setTimeout('changedirs()',change);
}
function animate(){
if(isNS){
tx=img1.left;
ty=img1.top;
xo=pageXOffset;
yo=pageYOffset;
}else{
tx=img1.pixelLeft;
ty=img1.pixelTop;
xo=document.body.scrollLeft;
yo=document.body.scrollTop;
}
if(ydir){
if((ty+incry)>(w_y+yo)){ ydir=false; moveimg(0,-incry); }else{ moveimg(0,incry); }
}else{
if((ty-incry)(w_x+xo)){ xdir=false; moveimg(-incrx,0); }else{ moveimg(incrx,0); }
}else{
if((tx-incrx)script>
вверх^
к полной версии
понравилось!
в evernote