如何设置窗口在30秒无鼠标或键盘响应的情况下自动关闭? 判断键盘的 onkeydown鼠标的 onmousemove 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 setTimeout ("self.close()",1000)这样只能对弹出窗口1秒后关闭,无法检测是否有事件发生 <SCRIPT LANGUAGE="JavaScript"><!--var t=setTimeout("close()",3000)document.onmousedown=new Function("clearTimeout(t)")document.onkeydown=new Function("clearTimeout(t)")//--></SCRIPT> 上面是判断窗口打开后3秒的。或者你要的也许是这个:<SCRIPT LANGUAGE="JavaScript"><!--t=setTimeout('close()',3000)setInterval("t=setTimeout('close()',3000)",1000)document.onmousemove=new Function("clearTimeout(t)")document.onkeydown=new Function("clearTimeout(t)")//--></SCRIPT>把3000改30000就是30秒了。 我以为opener=null在2800下面没有用呢,谁知道照样管用:<SCRIPT LANGUAGE="JavaScript"><!--opener=null;t=setTimeout('close()',3000)setInterval("t=setTimeout('close()',3000)",1000)document.onmousemove=new Function("clearTimeout(t)")document.onkeydown=new Function("clearTimeout(t)")//--></SCRIPT>这下没有提示了。 算了.... 帮你写了完整代码. 50 分拿来哟 ~~~剩余:<span id=show></span> 秒<SCRIPT LANGUAGE="JavaScript"><!--var kd=false,mv=false,md=false;var otime=30;function bt(){if(!kd && !mv && !md){otime--;show.innerText=otime;if(otime<=0){window.close()}}else{otime=30;kd=false,mv=false,md=false;}setTimeout('bt()',1000);}document.onkeydown=new Function('kd=true')document.onmousemove=new Function('mv=true')document.onmousedown=new Function('md=true')bt();//--></SCRIPT> 嘻嘻.. 再加上 opener=null; 就是完美的了.无论是原窗口还是打开窗口都能关了. :) javascript的节点问题 请问,我如何记录滚动条位置,就像qq一样,如果滚动条在最下面,有新信息滚动条跟着向下 用js改变多选框传递的参数的问题 javascript中怎样把请求转发? objRow.insertCell(0) 是在表格上插入第一列,怎么表示插入多列呢? 大师请进JS取出一天没有标出来的时间段 js实现textarea里面某段选中的文字 在javascript中怎样使用session或者Application 重新讨论这个效果如何实现 response.redirect问题 ****------怎么在IE里获得选中的文本----- help!!!!
这样只能对弹出窗口1秒后关闭,无法检测是否有事件发生
<!--
var t=setTimeout("close()",3000)
document.onmousedown=new Function("clearTimeout(t)")
document.onkeydown=new Function("clearTimeout(t)")
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
t=setTimeout('close()',3000)
setInterval("t=setTimeout('close()',3000)",1000)
document.onmousemove=new Function("clearTimeout(t)")
document.onkeydown=new Function("clearTimeout(t)")
//-->
</SCRIPT>把3000改30000就是30秒了。
<!--
opener=null;
t=setTimeout('close()',3000)
setInterval("t=setTimeout('close()',3000)",1000)
document.onmousemove=new Function("clearTimeout(t)")
document.onkeydown=new Function("clearTimeout(t)")
//-->
</SCRIPT>这下没有提示了。
<SCRIPT LANGUAGE="JavaScript">
<!--
var kd=false,mv=false,md=false;
var otime=30;
function bt(){
if(!kd && !mv && !md){
otime--;
show.innerText=otime;
if(otime<=0){window.close()}
}else{
otime=30;
kd=false,mv=false,md=false;
}
setTimeout('bt()',1000);
}
document.onkeydown=new Function('kd=true')
document.onmousemove=new Function('mv=true')
document.onmousedown=new Function('md=true')
bt();
//-->
</SCRIPT>