<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>
posted on 2008-07-10 13:21  wkjs  阅读(255)  评论(0)    收藏  举报