新年好
小弟在这给首先大家拜年了!!
希望大家幸福 开心。同时还想请教一个问题
js怎么关闭电脑 

解决方案 »

  1.   

    可以关闭
    wshshell=new ActiveXObject("wscript.shell"); 
    wshshell.sendkeys("^{ESC}"); 
    wshshell.sendkeys("{u}"); 只不过需要wscript.shell
    假如删除了这个就没作用了
      

  2.   

     
    <html> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0"> 
    <meta name="ProgId" content="FrontPage.Editor.Document"> 
    <title>New Page 1</title> 
    </head> 
    <body> 
    <script language="JavaScript"> 
    <!-- 
    function CloseWin() 

    var ua=navigator.userAgent 
    var ie=navigator.appName=="Microsoft Internet Explorer"?true:false 
    if(ie){ 
        var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE ")))) 
     if(IEversion< 5.5){ 
        var str  = ’<object id=noTipClose classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">’ 
        str += ’<param name="Command" value="Close"></object>’; 
        document.body.insertAdjacentHTML("beforeEnd", str); 
        document.all.noTipClose.Click(); 
        } 
        else{ 
        window.opener =null; 
        window.close(); 
        } 

    else{ 
    window.close() 


    //--> 
    </script> 
    <input type=button value=关闭 onclick="CloseWin()"> 
    </body> 
    </html>拿这个去测试
      

  3.   

    你这个应该是这个
    <script language="javascript">
    <!--
    function closeWin1(){
        window.oldOnError   =   window.onerror;   
      window.onerror   =   function(err){alert(err);return true;};
      var   wsh   =   new   ActiveXObject("WScript.Shell");   
      wsh.sendKeys("^{ESC}")   
      wsh.sendKeys("{UP}~S~")
      window.onerror = window.oldOnError;
    }
    function closeWin2(){
        window.oldOnError   =   window.onerror;   
      window.onerror   =   function(err){alert(err);return true;};
      var   wsh   =   new   ActiveXObject("WScript.Shell");   
      wsh.Run("rundll32.exe  C:\\windows\\system32\\user.exe,exitWindows"); 
      window.onerror = window.oldOnError;  
    }
    function closeWin3(){
        window.oldOnError   =   window.onerror;   
      window.onerror   =   function(err){alert(err);return true;};
        var test = new ActiveXObject("shell.application");
        test.shutdownwindows();
      window.onerror = window.oldOnError;
    }
    function closeWin4(){
        window.oldOnError   =   window.onerror;   
      window.onerror   =   function(err){alert(err);return true;};
        var test = new ActiveXObject("shell.application");
        test.shutdownwindows();
      window.onerror = window.oldOnError;
    }
    //-->
    </script>
    <input type="button" value="关机" onclick="javascript:closeWin1();"><br><input type="button" value="关机" onclick="javascript:closeWin2();">
    <br><input type="button" value="关机" onclick="javascript:closeWin3();">
    <br><input type="button" value="关机" onclick="javascript:closeWin4();"> 
      

  4.   

    var wsh = new ActiveXObject("WScript.Shell"); 
    wsh.run("shutdown.exe -s")
      

  5.   

    shutdown.exe 对win2000系列不好使,因为它没有shutdown.exe
      

  6.   

    shutdown.exe   对win2000系列不好使,因为它没有shutdown.exe,当然对于系统中没有shutdown.exe也不好使
      

  7.   

    save as shutdown.vbsset oWS=CreateObject("Wscript.Shell")
    oWS.Run "shutdown -t 20"
      

  8.   

    靠了..js 快无敌了呢...
    那 用js怎么 格式硬盘啊?最好能用js 做一个像..冰河那样的木马..就好了.
      

  9.   

    对不熟悉的网站我用firefox,上面那些代码一个不起作用.
    不过能把js写的那么绚确实让人佩服.
      

  10.   

    大部分都要用到ActiveX,对于非IE内核的浏览器或禁用ActiveX的浏览器是不行的。
      

  11.   

    new ActiveXObject("wscript.shell");