Phiên bản đầy đủ: jsB@nk » Màu nền » Hiệu ứng nền » Tạo một hồ cá trên website
URL: https://www.javascriptbank.com/swimming-fish-backgrounder.html
Hiệu ứng dùng các hình minh họa để tạo ra một hồ cá trên trang web.
Phiên bản đầy đủ: jsB@nk » Màu nền » Hiệu ứng nền » Tạo một hồ cá trên website
URL: https://www.javascriptbank.com/swimming-fish-backgrounder.html
<body background="fish.jpg" onload=pagestart(); onunload="if(brOK) {stopme('chip1'); stopme('chip2'); stopme('chip3');}"><SCRIPT language=JavaScript><!-- bat dau doan js bong bong bay lenImage0=new Image();Image0.src="bongbong.gif";Amount=15; //so luong bong bongYpos=new Array();Xpos=new Array();Speed=new Array();rate=new Array();grow=new Array();Step=new Array();Cstep=new Array();nsSize=new Array();ns=(document.layers)?1:0;WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;for (i=0; i < Amount; i++){ Ypos[i] = Math.round(Math.random()*WinHeight); Xpos[i] = Math.round(Math.random()*WinWidth); Speed[i]= Math.random()*4+4; Cstep[i]=0; Step[i]=Math.random()*0.1+0.05; grow[i]=10; nsSize[i]=Math.random()*15+5;}if (ns){for (i = 0; i < Amount; i++){document.write("<LAYER NAME='sn"+i+"' LEFT=0 TOP=0><img src="+Image0.src+" name='N' width="+nsSize[i]+" height="+nsSize[i]+"></LAYER>");}}else{document.write('<div style="position:absolute;top:0px;left:0px"><div style="position:relative">');for (i = 0; i < Amount; i++){document.write('<img id="si" src="'+Image0.src+'" style="position:absolute;top:0px;left:0px;filter:alpha(opacity=60)">');}document.write('</div></div>');}function bubbles(){var WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;var WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;var hscrll=(document.layers)?window.pageYOffset:document.body.scrollTop;var wscrll=(document.layers)?window.pageXOffset:document.body.scrollLeft;for (i=0; i < Amount; i++){sy = Speed[i]*Math.sin(270*Math.PI/180);sx = Speed[i]*Math.cos(Cstep[i]);Ypos[i]+=sy;Xpos[i]+=sx; rate[i]=0.4;if (Ypos[i] < -50){Ypos[i]=WinHeight+50;Xpos[i]=Math.round(Math.random()*WinWidth);Speed[i]=Math.random()*4+6;grow[i]=2;nsSize[i]=Math.random()*15+5;}if (ns){document.layers['sn'+i].left=Xpos[i]+wscrll;document.layers['sn'+i].top=Ypos[i]+hscrll;}else{si[i].style.pixelLeft=Xpos[i]+wscrll;si[i].style.pixelTop=Ypos[i]+hscrll;si[i].style.width=grow[i];si[i].style.height=grow[i]; }grow[i]+=rate[i]; Cstep[i]+=Step[i];if (grow[i] > 24) grow[i]=25;}setTimeout('bubbles()',10);}bubbles();//--> </SCRIPT><!--------------------------ket thuc doan javascript bong bong bay len------------------------><!------ Phia duoi la bat dau js ca boi- nho them cac thong so trong the body----------------><!--Day la doan js bong bong bay trong site da duoc gioi thieu tren echip( Mr - Hot ) mi`nh da doi tha`nh anh ba con ca'--><SCRIPT language=JavaScript> var brOK=false; var mie=false; var aver=parseInt(navigator.appVersion.substring(0,1)); var aname=navigator.appName; function checkbrOK() {if(aname.indexOf("Internet Explorer")!=-1) {if(aver>=4) brOK=navigator.javaEnabled(); mie=true; } if(aname.indexOf("Netscape")!=-1) {if(aver>=4) brOK=navigator.javaEnabled();} } var vmin=2; var vmax=5; var vr=2; var timer1; function Chip(chipname,width,height) {this.named=chipname; this.vx=vmin+vmax*Math.random(); this.vy=vmin+vmax*Math.random(); this.w=width; this.h=height; this.xx=0; this.yy=0; this.timer1=null;} function movechip(chipname) { if(brOK) {eval("chip="+chipname); if(!mie) {pageX=window.pageXOffset; pageW=window.innerWidth; pageY=window.pageYOffset; pageH=window.innerHeight; } else {pageX=window.document.body.scrollLeft; pageW=window.document.body.offsetWidth-8; pageY=window.document.body.scrollTop; pageH=window.document.body.offsetHeight; } chip.xx=chip.xx+chip.vx; chip.yy=chip.yy+chip.vy; chip.vx+=vr*(Math.random()-0.5); chip.vy+=vr*(Math.random()-0.5); if(chip.vx>(vmax+vmin)) chip.vx=(vmax+vmin)*2-chip.vx; if(chip.vx<(-vmax-vmin)) chip.vx=(-vmax-vmin)*2-chip.vx; if(chip.vy>(vmax+vmin)) chip.vy=(vmax+vmin)*2-chip.vy; if(chip.vy<(-vmax-vmin)) chip.vy=(-vmax-vmin)*2-chip.vy; if(chip.xx<=pageX) {chip.xx=pageX; chip.vx=vmin+vmax*Math.random(); } if(chip.xx>=pageX+pageW-chip.w) {chip.xx=pageX+pageW-chip.w; chip.vx=-vmin-vmax*Math.random(); } if(chip.yy<=pageY) {chip.yy=pageY; chip.vy=vmin+vmax*Math.random(); } if(chip.yy>=pageY+pageH-chip.h) {chip.yy=pageY+pageH-chip.h; chip.vy=-vmin-vmax*Math.random(); } if(!mie) {eval('document.'+chip.named+'.top ='+chip.yy); eval('document.'+chip.named+'.left='+chip.xx); } else {eval('document.all.'+chip.named+'.style.pixelLeft='+chip.xx); eval('document.all.'+chip.named+'.style.pixelTop ='+chip.yy); } chip.timer1=setTimeout("movechip('"+chip.named+"')",100); } } function stopme(chipname) {if(brOK) {//alert(chipname) eval("chip="+chipname); if(chip.timer1!=null) {clearTimeout(chip.timer1)} } } </SCRIPT> <SCRIPT> var chip1; var chip2; var chip3; function pagestart() {checkbrOK(); chip1=new Chip("chip1",60,80); chip2=new Chip("chip2",60,80); chip3=new Chip("chip3",60,80); if(brOK) { movechip("chip1"); movechip("chip2"); movechip("chip3"); } } </SCRIPT> <DIV id=chip1 style="HEIGHT: 68px; POSITION: absolute; WIDTH: 47px"> <DD> <P align=left> <IMG border=0 height=108 src="ca2.gif" width=47> <!anh con ca do> </P></DD></DIV> <DIV id=chip2 style="HEIGHT: 88px; POSITION: absolute; WIDTH: 67px"> <DD> <IMG border=0 height=120 src="ca.gif" width=120> <!anh con ca xanh> </DD> </DIV> <DIV id=chip3 style="HEIGHT: 68px; POSITION: absolute; WIDTH: 47px"> <DD><IMG border=0 height=68 src="ca2.gif" width=47> <!anh con ca do> </DD></DIV> <!-----------------------------ket thuc js ba con ca boi --------------------------------> <!--Chuc cac ban thanh cong--> </body>
/javascript/background/Swimming_Fish_Backgrounder/images.zip