html中使用javascript调用本地程序(exe,doc等)

来源:互联网 发布:大数据需要解决的问题 编辑:程序博客网 时间:2024/06/06 00:57

第一次用到这个,做个记录,在html页面中调用本地程序:

 

<html> <head>  <script language="javascript">   function Run(strPath)   {     var objShell = new ActiveXObject("wscript.shell");     objShell.exec(strPath);     objShell = null;   }  </script> </head> <body>  请输入要运行的程序路径:<br>  <input name=exe type=text size=20 value="D:\\a.doc">  <BUTTON   class=button  onclick="Run(exe.value)">确定</BUTTON> </body>  </html>