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