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!

Message

Status
Not open for further replies.

mic12345

Programmer
Jun 19, 2002
14
0
0
US
Hi,
I'm new to VBScript. I wrote small piece of code and when I
run on browser, I don't receive message when click on button.

here is the code.<HTML>
<HEAD>
<TITLE>This is a VB Script test apge</TITLE>
</HEAD>
<BODY>
<H1>
<CENTER>
<EM>VBScript Test Page</EM></H1>
<HR>
<INPUT TYPE=&quot;BUTTON&quot; VALUE=&quot;Click Here&quot; NAME=&quot;Button&quot;>

</CENTER>
<HR>
<SCRIPT type=&quot;text/VBScript&quot;>
Sub Button_OnClick()
MsgBox &quot;You just clicked test button.&quot;
End Sub
</SCRIPT>

</BODY>
</HTML>

please advice me
 
try this
<SCRIPT type=&quot;text/VBScript&quot;>
Sub Button_OnClick()
DIM MyMsg
MyMsg = MsgBox (&quot;You just clicked test button.&quot;, vbOKOnly)
End Sub
</SCRIPT>
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
Thanks for the quick reply but no luck..
Do I'm missing any thing???
 
try this to see if it works correctly
<HTML>
<HEAD>
<SCRIPT type=&quot;text/VBScript&quot;>
Sub message()
MsgBox &quot;You just clicked test button.&quot;
End Sub
</SCRIPT>
</HEAD>
<BODY>
<H1>
<CENTER>
<EM>VBScript Test Page</EM></H1>
<HR>
<INPUT TYPE=&quot;BUTTON&quot; VALUE=&quot;Click Here&quot; NAME=&quot;Button&quot; onClick=&quot;message()&quot;>

</CENTER>
<HR>
</BODY>
</HTML>
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
Nothing happend..correct me if I'm wrong, looks like
my VBScript is not at all executing...Is that right??
 
want to here the best part. I just tried the original code in EI5 and it works fine. I thought it look OK. What browser are you running. I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
try this bit in a html and if you do not get the alert you are running a browser that does not support VBscript
<SCRIPT LANGUAGE=&quot;VBScript&quot;>
<!--
Sub window_onLoad()
alert &quot;Your browser is VBScript compatible.&quot;
end Sub
-->
</SCRIPT> I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
I did not receive any alerts that means my browser is
compatible to VBScript though it is IE5. In that case
what I should to make it campatable
 
this may be your solution to your browser not running VBscript
go to
Tools/internet options
got to
security tab and choose the restricted sites icon and click custom level
make sure that Script ActiveX controls is enabled.
If it is not you will not be able to run Vbscript
I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
I looked and there is only one zone which is called INTERNET. I changed the INTERNET zone to custom level and also enabled Script ActiveX controls but still no luck
 
is Scripting
- Active Scripting
in the same place enabled. (INTERNET)
this also needs to be enabled I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
Thanks for your all help. IS is going to clean my hard drive
so I will test it again Monday .

Thanks again
 
hi i'm new but know the answer you dont make brackets behind
Button_OnClick

it will look like this

<SCRIPT type=&quot;text/VBScript&quot;>
Sub Button_OnClick
MsgBox &quot;You just clicked test button.&quot;
End Sub
</SCRIPT>

btw next time print it in the head section
 
That really makes no difference here. Having () or not in the onClick method as is will not cause a difference in the performance. The script is fine and works correctly IE5+. I may not get it the 1st or 2nd time,
but how sweet that 15th time can be.
 
I'm having some problem with my browser settings. I tested
in my collegue broswer and working fine. For different reasons, IS cleaning my hard drive so I will wait for new instalation and then I will test it. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top