Problem with Vb script
Hi everyone,
I am new to the programming world and this forum as well. As it can be seen on developerbarn’s forum the advice are very helpful, I hope someone can help me out.
I am trying to learn vb script and asp which is the next step to create some web pages , so I have tried to code a simple comparison procedure which compares the number 12 with any number the user inserted from an input box. But I know it might sound like a silly question, but I don’t know what I am doing wrong, and can someone help me out please???
One more question please, if anybody knows any online resources which are very helpful to learn vb scripts and asp please do let me know.
Thanks a lot in advance
Code:
<HTML>
<HEAD>
<TITLE>Working With VBScript: Exercise 1</TITLE>
<SCRIPT LANGUAGE="VBScript">
<!-- Add this to instruct non-IE browsers to skip over VBScript modules.
Option Explicit
Sub cmdCalculate_OnClick
Dim Compare
Compare = document.frmExercise2.txtQuantity.value
' Perform Comparison.When the user insert a number the following procedure compare it and display a result.
If document.frmExercise2.txtQuantity.value > 12 Then
document.write("The value is greater than 12!")
Else
document.write("The value is equal to or less than 12!")
Endif
End Sub
-->
</SCRIPT>
</HEAD>
<BODY>
<H1>First VBScript Exercise</H1>
<P> This is my first attempt to write a procedure</P>
<FORM NAME="frmExercise2">
<TABLE>
<TR>
<TD><B>Insert number:</B></TD>
<TD><INPUT TYPE="Text" NAME="txtQuantity" SIZE=5></TD>
</TR>
</TABLE>
<BR>
<INPUT TYPE="Button" NAME="cmdCalculate" VALUE="Calculate Cost">
</FORM>
</BODY>
</HTML>
Learner, September 17th, 2009 06:50 AM
Bookmarks