快速拖动层引发的断离现象? 点击后在body之类的元素注册移动事件 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title></title><script language="javascript">var ie = navigator.appName == "Microsoft Internet Explorer";var count = 24;var r = 80; //圆半径var speed = 8; //速度var arc = 0;var newLeft = oldLeft = 0;var newTop = oldTop = 0;var divs = [];function init(){ for(var i=1;i<=count;i++) { var div = document.createElement("DIV"); with(div.style) { width = 2; height = 2; backgroundColor = "#FF0000"; position = "absolute"; zIndex = i + 10; } div.id = "div" + i; div.innerHTML = "<img src='' width=1 height=1 style=filter:alpha(opacity=0)/>"; document.body.appendChild(div); divs.push(div); } arc = 360 / divs.length; delay();}function changePos(point){ for(var i=1;i<=divs.length;i++) { var x = r * Math.cos(arc * i * Math.PI/180); var y = r * Math.sin(arc * i * Math.PI/180); divs[i-1].style.left = point.x + x; divs[i-1].style.top = point.y + y; arc += speed / 1000; if(arc > 360 * 2)arc = 360; }}function getPos(){ return {x:newLeft,y:newTop};}document.onmousemove = function(e){ var ev = ie ? window.event : e; oldLeft = ie ? ev.x : ev.pageX; oldTop = ie ? ev.y : ev.pageY;}function delay(){ newTop += (oldTop - newTop) / 20; newLeft += (oldLeft - newLeft) / 20; changePos(getPos()); setTimeout("delay();",10);}</script></head><body onLoad="init();"></body></html>存成HTML看效果, 用这种原理吧. 请教各位大牛俄罗斯方块的做法 如何锁定一个函数的作用域? <javascript:; 向高手求救:关于在一个页面中获得其中iframe中鼠标点击的内容的属性!!! 高分求一个JS判断文本框输入的字符是否是"2006-11-09"这种格式! 如何让window.open打开的窗口位于顶端? js控制按钮的一个问题,请教! 小弟第一次来这里,请大家关照阿! 为什么history.back()会将前一屏清空? 求助Jquery LigerUI ligerAccordion 的一个问题,急!急!急! window.open问题 firefox java操作数组的问题!!
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<script language="javascript">
var ie = navigator.appName == "Microsoft Internet Explorer";
var count = 24;
var r = 80; //圆半径
var speed = 8; //速度var arc = 0;
var newLeft = oldLeft = 0;
var newTop = oldTop = 0;
var divs = [];function init()
{
for(var i=1;i<=count;i++)
{
var div = document.createElement("DIV");
with(div.style)
{
width = 2;
height = 2;
backgroundColor = "#FF0000";
position = "absolute";
zIndex = i + 10;
}
div.id = "div" + i;
div.innerHTML = "<img src='' width=1 height=1 style=filter:alpha(opacity=0)/>";
document.body.appendChild(div);
divs.push(div);
} arc = 360 / divs.length;
delay();
}function changePos(point)
{
for(var i=1;i<=divs.length;i++)
{
var x = r * Math.cos(arc * i * Math.PI/180);
var y = r * Math.sin(arc * i * Math.PI/180);
divs[i-1].style.left = point.x + x;
divs[i-1].style.top = point.y + y;
arc += speed / 1000;
if(arc > 360 * 2)arc = 360;
}
}function getPos()
{
return {x:newLeft,y:newTop};
}document.onmousemove = function(e)
{
var ev = ie ? window.event : e;
oldLeft = ie ? ev.x : ev.pageX;
oldTop = ie ? ev.y : ev.pageY;
}function delay()
{
newTop += (oldTop - newTop) / 20;
newLeft += (oldLeft - newLeft) / 20;
changePos(getPos());
setTimeout("delay();",10);
}
</script>
</head><body onLoad="init();">
</body>
</html>存成HTML看效果, 用这种原理吧.