zoukankan      html  css  js  c++  java
  • js网页中调用本地应用程序

    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Test ActiveXObject</title>
        <script>
            function Run(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);
                window.onerror = window.oldOnError;
            }
        </script>
    </head>
    <body>   
    <h1 align="center">网页中调用本地应用程序</h1>
      请输入要运行的程序:<br/><input   name=exe   type=text   size=20   value="regedit">
      <button   class=button   onclick="Run(exe.value)">确定</button>
      <button   class=button   onclick=exe.value="";>重新输入</button><br/>
      <button   class=button   onclick="Run('notepad')">记事本</button><br/>
      <button   class=button   onclick="Run('mspaint')">画图板</button><br/>
      <button   class=button   onclick="Run('calc')">计算器</button><br/>
      <button   class=button   onclick="Run('cmd')">cmd</button><br/>
      <button   class=button   onclick="Run('Regedit')">regedit</button><br/>
      <button   class=button   onclick="Run('Msconfig')">msconfig</button><br/>
      <button   class=button   onclick="Run('file:///D:/Program%20Files/Winamp/WINAMP.EXE')">winamp</button><br/>
      <button   class=button   onclick="Run('IEXPLORE.EXE')">IE</button><br/>
      <button   class=button   onclick="Run('..')">..</button><br/>
      <button   class=button   onclick="Run('%windir%')">%windir%</button><br/>
      <button   class=button   onclick="Run('%temp%')">%temp%</button><br/>
      <button   class=button   onclick="Run('file:///D:/Program%20Files/Tencent/qq.EXE')">winamp</button>
    </body>
    </html>
  • 相关阅读:
    DataTables 控件使用和心得 (2)
    dataTables 添加行内操作按钮
    datatables 配套bootstrap3样式使用小结(1)
    loadrunner总体使用篇
    使用CEF类库处理HTTP请求
    27部优秀的黑客纪录片
    CEF3开发者系列之进程和线程
    cef3的各个接口你知道几个
    [你必须知道的.NET]第二十九回:.NET十年(上)
    [你必须知道的.NET]第二十八回:说说Name这回事儿
  • 原文地址:https://www.cnblogs.com/elves/p/3713980.html
Copyright © 2011-2022 走看看