Never mind, I solved it.
It should just be
<a href="#" onclick="runnp()">Run notepad.exe</a>
Original question:
I'm trying to write a webpage that will launch programs on my local computer. How come only the vbscript version works? Nothing happens when I click the jscript link.
<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>
How can I make the jscript version work? (IE8 on XPsp2)