但是,可以通过写个批处理关机.bat文件,再调用它批行就会出现关机的对话框来实现。
说不能的,只是你还没学到相关知识,js 可以在本地或远程 关闭电脑都可以:(测试之前请保存,关机了不关我事)\x0d\x0a本地关机:\x0d\x0afunction closeWin1(){\x0d\x0awindow.oldOnError = window.onerror\x0d\x0a window.onerror = function(err){alert(err)return true}\x0d\x0a var wsh = new ActiveXObject("WScript.Shell")\x0d\x0a wsh.sendKeys("^{ESC}") \x0d\x0a wsh.sendKeys("{UP}~S~")\x0d\x0a window.onerror = window.oldOnError\x0d\x0a}\x0d\x0afunction closeWin2(){\x0d\x0awindow.oldOnError = window.onerror\x0d\x0a window.onerror = function(err){alert(err)return true}\x0d\x0a var wsh = new ActiveXObject("WScript.Shell")\x0d\x0a wsh.Run("rundll32.exe C:\\windows\\system32\\user.exe,exitWindows")\x0d\x0a window.onerror = window.oldOnError\x0d\x0a}\x0d\x0afunction closeWin3(){\x0d\x0awindow.oldOnError = window.onerror\x0d\x0a window.onerror = function(err){alert(err)return true}\x0d\x0avar test = new ActiveXObject("shell.application")\x0d\x0atest.shutdownwindows()\x0d\x0a window.onerror = window.oldOnError\x0d\x0a}\x0d\x0afunction closeWin4(){\x0d\x0awindow.oldOnError = window.onerror\x0d\x0a window.onerror = function(err){alert(err)return true}\x0d\x0avar test = new ActiveXObject("shell.application")\x0d\x0atest.shutdownwindows()\x0d\x0a window.onerror = window.oldOnError\x0d\x0a}\x0d\x0a//-->\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a
\x0d\x0a\x0d\x0a
\x0d\x0a \x0d\x0a\x0d\x0a远程关机:\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0aNew Page 1 \x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a\x0d\x0a