What's wrong with this VBScript? When I press on the button, the msgbox doesn't open..
<html> <head> <script language="VBScript"> Sub showMsg MsgBox "Hello"; End Sub </script> </head> <body> <button onclick="showMsg">Show Message</button> <p> </body> </html>
You haven't actually invoked the sub. Try
Check out this link .. Instead of calling the function from the button as you do in JS, its the name of the VB function's relation to the name of the button that matters.
Sub showMsg_OnClick MsgBox "Hello" End Sub
<button name="showMsg">Show Message</button>
BUT also see this link VB Script is on its way out and may have limited functionality in current versions of IE and Win10's Edge.
If your environment is XP it might work, doesn't work for me but you are not looking at VB script unless to support legacy code.
EDIT: You can get the VB script code to work in IE if you go into developer tools (F12) and set the IE version to 10 or older.