?? 12.html
字號:
<html>
<head>
<title>圍繞鼠標中心旋轉的彩帶</title>
</head>
<body>
<script language="JavaScript">
if (document.all){
with (document){
write('<div id="starsDiv" style="position:absolute;top:0px;left:0px">')
/* 以下設置彩帶中各點的大小以及顏色*/
write('<div style="position:relative;width:2px;height:2px;background:red;font-size:1px;visibility:visible"></div>')
write('<div style="position:relative;width:2px;height:2px;background:yellow;font-size:1px;visibility:visible"></div>')
write('<div style="position:relative;width:2px;height:2px;background:green;font-size:1px;visibility:visible"></div>')
write('<div style="position:relative;width:2px;height:2px;background:blue;font-size:1px;visibility:visible"></div>')
write('<div style="position:relative;width:2px;height:2px;background:black;font-size:1px;visibility:visible"></div>')
write('<div style="position:relative;width:2px;height:2px;background:purple;font-size:1px;visibility:visible"></div>')
write('<div style="position:relative;width:2px;height:2px;background:olive;font-size:1px;visibility:visible"></div>')
write('<div style="position:relative;width:3px;height:3px;background:navy;font-size:2px;visibility:visible"></div>')
write('<div style="position:relative;width:3px;height:3px;background:teal;font-size:2px;visibility:visible"></div>')
write('<div style="position:relative;width:3px;height:3px;background:fuchsia;font-size:2px;visibility:visible"></div>')
write('<div style="position:relative;width:4px;height:5px;background:maroon;font-size:2px;visibility:visible"></div>')
write('<div style="position:relative;width:4px;height:5px;background:gray;font-size:2px;visibility:visible"></div>')
write('<div style="position:relative;width:5px;height:5px;background:aqua;font-size:2px;visibility:visible"></div>')
write('<div style="position:relative;width:6px;height:6px;background:lime;font-size:3px;visibility:visible"></div>')
write('</div>')
}
}
if (document.layers)
{window.captureEvents(Event.MOUSEMOVE);}
var yBase = 200;
var xBase = 200;
var step = 1;
var currStep = 0;
var Xpos = 1;
var Ypos = 1;
if (document.all)
{
function MoveHandler(){
Xpos = document.body.scrollLeft+event.x;
Ypos = document.body.scrollTop+event.y;
}
document.onmousemove = MoveHandler;
}
else if (document.layers)
{
function xMoveHandler(evnt){
Xpos = evnt.pageX;
Ypos = evnt.pageY;
}
window.onMouseMove = xMoveHandler;
}
function animateLogo() {
if (document.all)
{
yBase = window.document.body.offsetHeight/6;
xBase = window.document.body.offsetWidth/6;
}
else if (document.layers)
{
yBase = window.innerHeight/8;
xBase = window.innerWidth/8;
}
if (document.all)
{
for ( i = 0 ; i < starsDiv.all.length ; i++ )
{
starsDiv.all[i].style.top = Ypos + yBase*Math.sin((currStep + i*4)/12)*Math.cos(400+currStep/200);
starsDiv.all[i].style.left = Xpos + xBase*Math.sin((currStep + i*3)/10)*Math.sin(currStep/200);
}
}
else if (document.layers)
{
for ( j = 0 ; j < 14 ; j++ ) //number of NS layers!
{
var templayer="a"+j
document.layers[templayer].top = Ypos + yBase*Math.sin((currStep + j*4)/12)*Math.cos(400+currStep/200);
document.layers[templayer].left = Xpos + xBase*Math.sin((currStep + j*3)/10)*Math.sin(currStep/200);
}
}
currStep+= step;
setTimeout("animateLogo()", 5); //設置旋轉的速度
}
animateLogo();
</script>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -