沃尔沃xc90魔力蓝图片:怎么弄有跟着鼠标跑的字

来源:百度文库 编辑:高考问答 时间:2024/04/28 16:14:54
网页做好了还想弄这个 怎么弄?

鼠标事件类
http://www.baron.com.cn/javascript/index7.asp

可以使用FLASH编辑器来实现 添加引导层 使需要运动的图层粘在引导层上面就可以了 注意如果是圆的话 中间必须断开

我觉得这个不错
<SCRIPT LANGUAGE="JavaScript">
ns = (document.layers)?1:0;
Clrs = new Array('ff0000','00ff00','ffffff','ff00ff','ffa500','ffff00','00ff00','ffffff','ff00ff')
yBase = 0;
xBase = 0;
step = 3;
currStep = 0;
Ypos = 0;
Xpos = 0;
if (ns){
for (i = 0; i < 14; i++)
document.write('<LAYER NAME="n'+i+'" LEFT=0 TOP=0 CLIP="0,0,'+i/4+','+i/4+'"></LAYER>');
window.captureEvents(Event.MOUSEMOVE);
function nMouse(evnt){
Ypos = evnt.pageY;
Xpos = evnt.pageX;
}
window.onMouseMove = nMouse;
}
else{
document.write('<div style="position:absolute;top:0;left:0"><div style="position:relative">');
for (i=0; i < 14; i++)
{document.write('<div id="me" style="position:absolute;top:0;left:0;width:'+i/4+';height:'+i/4+';font-size:'+i/4+'"></div>')}
document.write('</div></div>');
function iMouse() {
Ypos = event.y+document.body.scrollTop;
Xpos = event.x+document.body.scrollLeft;
}
document.onmousemove = iMouse;
}
function Comet() {
var yBase = (document.layers)?window.innerHeight/4:window.document.body.clientHeight/4;
var xBase = (document.layers)?window.innerWidth/4:window.document.body.clientWidth/4;
for (i = 0; i < 14; i++){
var randCol = Math.round(Math.random()*8);
var layer = (document.layers)?document.layers['n'+i]:me[i].style;
layer.top =Ypos + yBase*Math.cos((currStep+i*4)/12)*Math.cos(0.7+currStep/200);
layer.left = Xpos + xBase*Math.sin((currStep+i*3)/10)*Math.sin(8.2+currStep/400);
if (ns) layer.bgColor = Clrs[randCol];
else
layer.background = Clrs[randCol];
}
currStep += step;
setTimeout("Comet()",10);
}
window.onload = Comet;

</script>