如何让定时器不停来,用SetTimeOut()来做,右键的时候定时器就停下来了要怎么让停时器不停下来
解决方案 »
- jquery tree如何获取节点下所有儿子节点,而不是全部节点
- JS获取客户端操作系统类型
- 如何统计子节点中出现最多的节点类型及其百分比?
- 关于截获其他网页新闻内容
- Stack overflow at line: 0
- 急!在线等! js或css设置input或textarea的高度自动适应文本内容长度
- 表单提交中文的乱码问题HELP>__________<
- [召唤帖]召集JavaScript内置对象扩展原型函数,要求经典、原创、分不是问题。
- 倒闭,没分了,等明天。
- 这是不是IE5.0的BUG,在线等候!!!如何解决?
- JS如何在子框架内设置父框架的同级框架里的属性。
- 请教一个表单控件事件的问题
<html>
<body>
<script type="text/javascript">
var i = 0; timer = null;
function setTime() {
document.getElementById("ospan").innerHTML = ++i;
timer = setTimeout(arguments.callee, 1000);
}
window.onload = function(){
setTime();
}document.onmousedown = function(e){
var e = e || window.event;
((e || window.event).button == 2) && clearTimeout(timer);
}
</script>
<span id="ospan"></span>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<span id="ss">aa</span>
</body>
<script language="javascript">
var c=0;
function ff(){
c=c+1;
document.getElementById("ss").innerHTML=c;
setTimeout("ff()",1000);
}
setTimeout("ff()",1000);
</script>
</html>
像上面的代码,点鼠标右键,定时器就停下来了 @_@
会不会无解
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<span id="ss">aa</span>
</body>
<script language="javascript">
var c=0;
var timer = null;
function ff(){
c=c+1;
document.getElementById("ss").innerHTML=c;
timer = setTimeout("ff()",1000);
}document.onmousedown = function(e){
var e = e || window.event;
((e || window.event).button == 2) && clearTimeout(timer);
}setTimeout("ff()",1000);
</script>
</html>
document.oncontextmenu = function(){
return false;
}// 把右键禁了吧