Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbscript/html code for button

Status
Not open for further replies.

shavon

Programmer
Jun 18, 2001
102
CA
Good day:

I created the following code for my Grade 4 computer students:
I am using Chrome. I simply wrote the code in a text file and changed the filename to "filename.html"

Why doesn't it work please? Thank you.


<HTML>
<HEAD>
<SCRIPT LANGUAGE="vbscript">

Sub cmdButton1_OnClick
msgbox("hello world")
End Sub

</SCRIPT>
</HEAD>

<BODY BGCOLOR="blue">
<INPUT TYPE="button" NAME="cmdButton1" VALUE="Run Code">
</BODY>
</HTML>
 
The only client browser that vbscript works in is Internet Explorer
 
You could convert it to javascript - then in will work on all other browsers including IE.
Code:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="vbscript">

function cmdButton1_OnClick()
{
    alert("hello world")
}

</SCRIPT>
</HEAD>

<BODY BGCOLOR="blue">
<INPUT TYPE="button" NAME="cmdButton1" VALUE="Run Code">
</BODY>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top