简体   繁体   中英

Execute VBScript file using HTML

I'm trying to Execute the following .vbs file using HTML. But it is not executing this. When i'm executing the .vbs file using command promt, it is working. But while trying to execute from HTML, it is not working.

demo.vbs file

Dim IE
 Set IE = CreateObject("InternetExplorer.Application")
 IE.Visible = 1 
 IE.navigate "http://testingwebpage/web"
 Do While (IE.Busy)
   WScript.Sleep 10
 Loop 
Set Helem = IE.document.getElementsByTagName("select")(0)
Helem.Click
WScript.Sleep 10000
Set Helem = IE.document.getElementByID("searchOptions_listbox").getElementsByTagName("li")(3)
Helem.Click
Set Helem = IE.document.getElementByID("orderNumberInput")
 Helem.Value="990462"
Set Helem = IE.document.getElementsByTagName("a")(9)
 Helem.Click

test.html

<html>

<head>
<title>printHello() Function in an Include File</title>

<script type="text/vbscript" src="demo.vbs"></script>

</head>
<body>
<button onclick="vbscript:MyFunc()">Click me</button> 
</body>
</html>

Thanks for the Answers..!!

This will not solve your problem, but you are calling a function MyFunc which is not declared (apparently) in the Vbscript

your code should be:

Public Function MyFunc
     'your code
End Function

written like you did, the code will execute at the page loading, not after clicking the button

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM