首页 > 编程 > JavaScript > 正文

JavaScript实现鼠标滑过处生成气泡的方法

2019-11-20 12:27:57
字体:
来源:转载
供稿:网友

本文实例讲述了JavaScript实现鼠标滑过处生成气泡的方法。分享给大家供大家参考。具体实现方法如下:

<HTML><HEAD><title>鼠标周围在网页上生成气泡</title></HEAD><BODY bgColor=#000000 scroll=no onload=zyva()><div id=aqua style="position:absolute;left=0;top=0;"></div><IMG id=B src="b1.gif" style="display:none"><SCRIPT>object = new Array()var xm,ymfunction CObj(N,obj){aqua.insertAdjacentHTML("AfterBegin","<img style='position:absolute;left:-1000;' src='"+obj.src+"'>")this.img = aqua.firstChild.stylemr = Math.random()this.v = 6*mr+4this.s = .5*mrthis.p = .1+mrthis.w = 0this.k = 0this.x = xmthis.y = Nthis.ChteuMeulEu = function ChteuMeulEu(){with(this){with(img){left = (x+=0.5*v*Math.sin(k+=s))-w*0.5top = y-=vwidth = Math.min(w+=p,100)}if(y<-w){w = 8y = ymx = xm}}}}function gradient(R,G,B,m){for(i=0;i<25;i++){c = 255 - 10 * iC = "/"RGB("+Math.round(c*R/255)+","+Math.round(c*G/255)+","+Math.round(c*B/255)+")/""code = "<span style='position:absolute;font-size:1pt;left=0;width=120%;height="+(m)+".2%;top="+(i*m)+"%;background="+C+";z-Index:-1000'></span>"document.body.insertAdjacentHTML("beforeEnd",code)}}function zyva(){xm = document.body.offsetWidth * 0.5ym = document.body.offsetHeightdocument.onmousemove = function (){xm = window.event.clientXym = window.event.clientY}for(i=0;i<60;i++)object[i] = new CObj(i,B)setInterval("for(i in object)object[i].ChteuMeulEu()",16)gradient(41,93,214,2)}</SCRIPT></BODY></HTML>

希望本文所述对大家的javascript程序设计有所帮助。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表