📄 11.htm
字号:
<html>
<head>
<title>跟随鼠标移动的星星</title>
<script language="javascript">
<!--
starNum = 10;
j = starNum-1;
mouseX = 0;
mouseY = 0;
function follow(){
mouseX = event.x;
mouseY = event.y;
}
function move(){
eval("s" + j).style.left = parseInt(eval("s" + (j-1)).style.left) + 30;
eval("s" + j).style.top = parseInt(eval("s" + (j-1)).style.top);
j--;
if (j<1){
j = starNum-1;
s0.style.left = mouseX + 20;
s0.style.top = mouseY + 20;
}
setTimeout("move()",5);
}
document.onmousemove = follow;
//-->
</script>
</head>
<body bgcolor="#000000">
<script language="javascript">
for(i=0;i<starNum;i++){
str = "<img id=s" + i + " src=star.gif "
str += "style='position:absolute;left:0;top:0;width:10;height:10'>"
document.write (str);
}
move();
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -