⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 8-4-2.html

📁 JavaScript经典实例教程代码
💻 HTML
字号:
<html>
<head>
<title>rotateLayer</title>
</head>
<script language="JavaScript">
/*--------------------------------\
|  Authored by CZH;czh44@sohu.com |
\--------------------------------*/
var yBase = 200;
var xBase = 200;
var step = 1;
var currStep = 0;
var Xpos = 1;
var Ypos = 1;
var tempLayer;
	with (document)
	{
	write('<div id=lay0 style="position:absolute;width:1px;height:1px;background:#000000;visibility:visible;font-size=1px"></div>')
	write('<div id=lay1 style="position:absolute;width:1px;height:1px;background:#000000;visibility:visible;font-size=1px"></div>')
	write('<div id=lay2 style="position:absolute;width:1px;height:1px;background:#000000;visibility:visible;font-size=1px"></div>')
	write('<div id=lay3 style="position:absolute;width:1px;height:1px;background:#000000;visibility:visible;font-size=1px"></div>')
	write('<div id=lay4 style="position:absolute;width:2px;height:2px;background:#000000;visibility:visible;font-size=1px"></div>')
	write('<div id=lay5 style="position:absolute;width:2px;height:2px;background:#000000;visibility:visible;font-size=1px"></div>')
	write('<div id=lay6 style="position:absolute;width:2px;height:2px;background:#000000;visibility:visible;font-size=1px"></div>')
	write('<div id=lay7 style="position:absolute;width:2px;height:2px;background:#000000;visibility:visible;font-size=1px"></div>')
	write('<div id=lay8 style="position:absolute;width:3px;height:2px;background:#000000;visibility:visible;font-size=1px"></div>')
	write('<div id=lay9 style="position:absolute;width:3px;height:2px;background:#000000;visibility:visible;font-size=1px"></div>')
	write('<div id=lay10 style="position:absolute;width:3px;height:2px;background:#000000;visibility:visible;font-size=1px"></div>')
	write('<div id=lay11 style="position:absolute;width:3px;height:3px;background:#000000;visibility:visible;font-size=1px"></div>')
	write('<div id=lay12 style="position:absolute;width:3px;height:3px;background:#000000;visibility:visible;font-size=1px"></div>')
	write('<div id=lay13 style="position:absolute;width:3px;height:3px;background:#000000;visibility:visible;font-size=1px"></div>')
	}
	function getMousePos2(eventObject)
	{
	    Xpos = document.body.scrollLeft+event.x;
	    Ypos = document.body.scrollTop+event.y;
	}
	document.onmousemove = getMousePos2;
function makeAnimate()
{
		yBase = window.document.body.clientHeight/8;
		xBase = window.document.body.clientWidth/8;
		for ( i = 0 ; i < 14; i++ )
		{
		tempLayer="lay"+i;
		document.getElementById(tempLayer).style.top = Ypos + yBase*Math.sin((currStep + i*4)/12)*Math.cos(400+currStep/200);
		document.getElementById(tempLayer).style.left = Xpos + xBase*Math.sin((currStep + i*3)/10)*Math.sin(currStep/200);
		}
	currStep += step;
	setTimeout("makeAnimate()", 10);
}
</script>
<body onload="makeAnimate()">
</body>
<html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -