您的位置:首页 > Web前端 > JavaScript

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

2013-11-28 00:00 651 查看
<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');"/>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐