JavaScript调用客户端的可执行文件(示例代码)

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

JavaScript调用客户端的可执行文件(示例代码)

  2020-05-13 我要评论

复制代码 代码如下:

<script>
<!--打开记事本程序-->
function openNotepad(){
 var wsh=new ActiveXObject("wscript.shell")
 wsh.run("notepad.exe")//如果在“运行”可以运行就可以在此直接写,否则要写上绝对路径
}
<!--打开word程序-->
function openWord()
{
 var wsh=new ActiveXObject("wscript.shell");
 wsh.run("calc.exe");
}
<!--打开指定位置程序-->
function openTxt(file)
{
 var wsh=new ActiveXObject("wscript.shell");
 wsh.run(file);
}
</script>

<input type="button" id="notepad" value="Notepad" onclick="openNotepad();"/>
<input type="button" id="word" value="word"  onclick="openWord();"/>
<input type="button" id="word" value="word"  onclick="openTxt('c://caipiao.txt');"/>

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们