js页面中运行本地程序
2012-06-16 07:49:45 来源:WEB开发网核心提示: <input onclick="exec('notepad.exe')" value="执行noteppad.exe" type="button"> <input onclick="exec('cmd.ex
<input onclick="exec('notepad.exe')" value="执行noteppad.exe" type="button">
<input onclick="exec('cmd.exe')" value="执行cmd.exe" type="button">
<script language="javascript"> function exec(command) { window.oldOnError = window.onerror; window._command = command; window.onerror = function (err) { if (err.indexOf('utomation') != -1) { alert('命令' + window._command + ' 已经被用户禁止!'); return true; } Else return false; }; //-----------// var wsh = new ActiveXObject('WScript.Shell'); if (wsh) wsh.Run(command); wsh = null; window.onerror = window.oldOnError; } </script>
更多精彩
赞助商链接