不让用户关闭窗口有些难做到.其它的没太大问题,可以用一个透明的空图片,放到页面的最上层,铺满整个页面.到允许用户操作时把这个图片隐藏就OK了.
<BODY onkeydown="return false;">
<img id="lockImg" src="这里放一个透明的空图片" style="position: absolute;top:0;left:0;width:100%;height:100%;z-index:10000">
<a href="adfsf">asdfsadfasdf</a>
<input type="button" value="按钮" onclick="alert('hehe');">
<pre>
解除锁定的时候,隐藏图片,去掉BODY里的onkeydown事件:
function unlock()
{
lockImg.style.display = "none";
document.body.onkeydown = null;
}
<pre>
</BODY>
<BODY onkeydown="return false;">
<img id="lockImg" src="这里放一个透明的空图片" style="position: absolute;top:0;left:0;width:100%;height:100%;z-index:10000">
<a href="adfsf">asdfsadfasdf</a>
<input type="button" value="按钮" onclick="alert('hehe');">
<pre>
解除锁定的时候,隐藏图片,去掉BODY里的onkeydown事件:
function unlock()
{
lockImg.style.display = "none";
document.body.onkeydown = null;
}
<pre>
</BODY>
<body >
<input type=text>
<a fref="KK">ggggggggg</a>
</body>
</html>
<script>
document.body.disabled=true;
</script>
<script for=window event="onbeforeunload">
event.returnValue="只能调出一个警告,不能取消关闭操作"
</script>