0
沒關係,我解決了它。jscript + wsh不能啓動notepad.exe,vbscript + wsh可以。爲什麼?
這應該只是
<a href="#" onclick="runnp()">Run notepad.exe</a>
原題:
我試圖寫一個網頁,將推出我的本地計算機上的程序。怎麼只有vbscript版本的作品?當我點擊jscript鏈接時沒有任何反應。
<html>
<head>
<script language="VBScript">
Sub RunProgram
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "notepad.exe"
End Sub
</script>
<script language="jscript">
function runnp() {
File="notepad.exe";
objShell = new ActiveXObject("WScript.Shell");
objShell.run(File);
}
</script>
</head>
<body>
<a href="#" onclick="RunProgram">Run Program</a>
<A href="#" onClick="runnp(); return false;">Run notepad.exe</A>
</body>
</html>
我該如何讓jscript版本工作? (IE8在XPSP2)
不要編輯你的問題添加「沒關係,我解決了它」。添加你的解決方案作爲答案(請參閱[我不應該回答我自己的問題嗎?](http://meta.stackexchange.com/q/12513)),但如果有人已經提供了答案,它可能更有禮貌地upvote/mark-as-correct-correct現有的,或者清楚你的解決方案如何不同/更好。 – bacar 2010-09-20 15:24:42
感謝您分享該鏈接。我認爲這不是回答我自己的問題的好習慣。 – Tobbe 2010-09-20 16:17:01