网络编程 
首页 > 网络编程 > 浏览文章

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

(编辑:jimmy 日期: 2025/10/24 浏览:3 次 )

复制代码 代码如下:
<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');"/>

上一篇:javascript列表框操作函数集合汇总
下一篇:js实现单行文本向上滚动效果实例代码
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网 网站地图 SiteMap