複製代碼代碼如下:
<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');"/>