<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Demo</title>
<script language="JavaScript" type="text/javascript">
function resetEscAndF5(e) {
e = e ? e : window.event;
actualCode = e.keyCode ? e.keyCode : e.charCode;
if(actualCode == 27) {
document.getElementById("D1").style.visibility=document.getElementById("D1").style.visibility=="hidden"?"visible":"hidden";
}
}
function _attachEvent(obj, evt, func) {
if(obj.addEventListener) {
obj.addEventListener(evt, func, false);
} else if(obj.attachEvent) {
obj.attachEvent("on" + evt, func);
}
}
_attachEvent(document.documentElement, 'keydown', resetEscAndF5);
</script>
</head>
<body>
<div id="D1"
style="height: 320px; width: 800px; position: absolute; top: 100px; left: 182px; background-color: #CC0000; visibility:hidden;">
</div>
</body>
</html>
网页ESC使用
最新推荐文章于 2023-05-26 11:47:42 发布