<script language="javascript" type="text/javascript">
??? document.onkeypress=function esckey()
??? {
??????? if(event.keyCode == 27)//点击“ESC”键
??????? {
??????????? var message=window.confirm("是否要关闭本窗体?点击\"是\"关闭,点击\"否\"打开Sohu.");
??????????? if(message == true)//点击“是”无提示关闭窗口
??????????? {
??????????????? window.opener = null;//没有这句话还会有一个提示窗口
??????????????? window.close();
??????????? }
??????????? else//打开126网站
??????????? {
??????????????? window.location.href="http://www.126.com";
??????????? }
???????????
??????? }
??? }
??? </script>