You need to create an ActiveX like so:
var shell = new ActiveXObject('WScript.Shell');
shell.Run(strCommand, intWindowStyle, bWaitOnReturn);
Please read the MSDN article about Run()
to populate the arguments.
题
I have this code:
<body background = "Image.png">
<body>
<input type="button" value="Option 1" name="run_button" onClick="TestSub"><p>
<input type="button" value="Option 2" name="run_button" onClick="TestSub"><p>
<input type="button" value="Option 3" name="run_button" onClick="TestSub"><p>
<input type="button" value="Option 4" name="run_button" onClick="TestSub"><p>
<input type="button" value="Option 5" name="run_button" onClick="TestSub"><p>
<input type="button" value="Option 6" name="run_button" onClick="TestSub"><p>
<input type="button" value="Option 7" name="run_button" onClick="TestSub"><p>
<input type="button" value="Option 8" name="run_button" onClick="TestSub"><p>
<input type="button" value="Option 9" name="run_button" onClick="TestSub"><p>
<input type="button" value="Option 10" name="run_button" onClick="TestSub"><p>
</body>
When i run it it comes up with 10 buttons but my questions is how do i get it to launch a program called test.exe when the first button is pressed
解决方案
You need to create an ActiveX like so:
var shell = new ActiveXObject('WScript.Shell');
shell.Run(strCommand, intWindowStyle, bWaitOnReturn);
Please read the MSDN article about Run()
to populate the arguments.