鼠标按住怎么做??? 伪代码:if(onmousedown){do{移动.....}while(!onmouseup);} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 下面一个例子,我是做的div,你把它换成img就行了:<html><head><title>test</title><script language=javascript>function a(){if(document.all.canMove.value==1){c();}}function b(){document.all.canMove.value=0;alert("up");}function c(){var top=document.all.div1.style.top;top=top.substring(0,top.length-2);if(top>0){document.all.div1.style.top=top-1;setTimeout('a()',100); }}function d(){document.all.canMove.value=1;a();}</script></head><body><input type=button value="add" onmousedown="d()" onmouseup="b()"><div id=div1 style="position:absolute;top:100px;left:100px;width:100px;height:100px;background-Color:#cccccc"></div><input type=hidden id="canMove" value="0"></body></html> 这个简单点,可以看看呵呵~<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>图片测试</title></head><body><style>div{ width:100px; height:100px; background:#FF0000; position:absolute; left: 28px; top: 17px;}</style><script>i=10;function aa(){i++;d.style.left=i+"px";nn=setTimeout(aa,100);}function dd(){clearTimeout(nn);}</script><div id="d"></div><p> </p><p> </p><p> </p><p> </p><p><a href="#" onmousedown="aa()" onmouseout="dd()">测试</a></p></body></html> 新手求教,页面切换后的数据问题 javascript 长时间按鼠标事件 谁替我看看这段代码 图片的切换代码,这样为什么不对? 求一正则表达式 限制以英文發表文章(全型字列入中文字範圍) 如何用脚本控制改变框架的大小?如单击一个图片把某个框架隐藏。 请问现在还有不被拦截的弹窗代码吗?或者能躲过上网助手和tt,myie的 新手问题,请大家务必帮忙 小问题——急 谁能帮我解释一下跑马灯的原理呀! constructor使用的问题 如何把这2段代码合成1断?
<html>
<head>
<title>test</title>
<script language=javascript>
function a(){
if(document.all.canMove.value==1){c();}
}
function b(){
document.all.canMove.value=0;
alert("up");
}
function c(){
var top=document.all.div1.style.top;
top=top.substring(0,top.length-2);
if(top>0){
document.all.div1.style.top=top-1;
setTimeout('a()',100);
}
}
function d(){
document.all.canMove.value=1;
a();
}
</script>
</head>
<body>
<input type=button value="add" onmousedown="d()" onmouseup="b()">
<div id=div1 style="position:absolute;top:100px;left:100px;width:100px;height:100px;background-Color:#cccccc"></div>
<input type=hidden id="canMove" value="0">
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>图片测试</title>
</head><body>
<style>
div{
width:100px;
height:100px;
background:#FF0000;
position:absolute;
left: 28px;
top: 17px;
}</style>
<script>
i=10;
function aa(){
i++;
d.style.left=i+"px";
nn=setTimeout(aa,100);}
function dd()
{
clearTimeout(nn);
}
</script>
<div id="d"></div>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p><a href="#" onmousedown="aa()" onmouseout="dd()">测试</a></p>
</body>
</html>