不准点击X来关闭当前网页
<script language=javascript>
function window.onbeforeunload()
{
if (event.clientX>document.body.clientWidth && event.clientY<0||event.altKey){
  window.event.returnValue="确定要退出本页吗?";
  new ActiveXObject("WScript.Shell").sendKeys("{ESC}")}
}
</script><input type=button value=关闭 onclick="window.opener=null;window.close()">
<!-- IE5.5以上不会有弹出提示 -->

解决方案 »

  1.   

    机器要重启,先放一下
    <textarea id=xxcode style='width:100%;height:100%'>
    <textarea style='display:none' name=xxabout>
        Freeonline[Version5],Copyright(C)2003,Bxxxr
        本程序是自由软件,遵循GPL,没有任何担保。详细情况请参阅GNU通用公共许可证。http://www.gnu.org/
        本程序是用JavaScript在网吧里写的。(98SE IE5 CR1G 128M)它的基本用途是在线编写脚本程序,还有一些小功能。
        Email:[email protected]
    &lt;/textarea>
    <script>
    function window::onbeforeunload(){
    if (event.clientY<0 && event.clientX>document.body.clientWidth-20
    || event.clientY<0 && event.clientX<20
    || event.altKey 
    || event.clientY>document.body.clientHeight)
    event.returnValue='Exit freeonline ?'
    }function window.onload()
    {
      document.title=xxabout.value
      self.moveTo(0,-4)
      self.resizeTo(screen.availWidth+4,screen.availHeight+8)
      xxcodearea.select()
      xxywj.value=window.location.href
      xxdiv.style.visibility="hidden"
    }function xxrun()
    {
      xxwww=xxcodearea.value;
      xxrrr=open('','','');
      xxrrr.document.open();
      xxrrr.document.write(xxwww);
      xxrrr.document.close();
    }
    </SCRIPT><body bgcolor=menu style=border:none scroll=no topmargin=0 leftmargin=0 
    onkeydown="if((event.ctrlKey&&event.keyCode==13)||event.keyCode==116){event.keyCode=0;event.returnValue=false;xxrun();}"><TEXTAREA name=xxcodearea wrap=off 
    oncontextmenu='window.event.returnValue=false;xxdiv.style.visibility="visible";'
    style="background-color:#f3f0fb; 
           color:#ae34f8;
           border:#ae34f8 solid 0px;
           font-weight:bolder; 
           width:100%;
           height:100%;
           overflow:auto">
    &lt;/TEXTAREA><DIV ID=xxdiv 
    oncontextmenu='window.event.returnValue=false;xxdiv.style.visibility="hidden";'
    style="background-color:menu; 
           filter:alpha(opacity=60);
           position:absolute;
           top:0;
           left:0;
           width:100%;
           height:100%;
           overflow:auto;">
    <input onclick='xxdiv.style.visibility="hidden";xxrun();' type=button value="运行"><p>
    <input onclick='xxdiv.style.visibility="hidden"' type=button value="编辑">
    <input type="text" value="http://" name="xxywj" size="20">
    <input onclick='xxdiv.style.visibility="hidden";window.location="view-source:"+xxywj.value;' type="button" value='源文件'>
    <FORM style="display:inline" action="file:///c|/My Documents/" method=get target=_blank>
    <input onclick='xxdiv.style.visibility="hidden"' type="submit" value='我的文档'></FORM>&nbsp;
    <input onclick='xxdiv.style.visibility="hidden";alert(xxabout.value);' type=button value='关于'>
    </DIV></body>
    </textarea>
    <!------------------------------>
    <object
    id=xxclose
    type="application/x-oleobject"
    classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
    <param name="Command" value="Close">
    </object><SCRIPT>
    function window.onload()
    {
      xxclose.Click()
      var xxclone=window.open("","","resizable=1,status=1")
      xxclone.document.open()
      xxclone.document.write(xxcode.value)
      xxclone.document.close()
    }
    </SCRIPT>
    机器要重启,先放一下