+ Reply to Thread
Results 1 to 5 of 5

Thread: Problem with Vb script

  1. #1
    Barn Newbie Learner is an unknown quantity at this point Learner's Avatar
    Join Date
    Sep 2009
    Posts
    3
    Rep Power
    3

    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>
    

  2. #2
    Lazy Bum micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky is a jewel in the rough micky's Avatar
    Join Date
    Jul 2008
    Location
    India
    Posts
    1,763
    Blog Entries
    2
    Rep Power
    8

    Hi and welcome to the forums.
    Here is a good site to learn asp
    ASP Tutorial

  3. #3
    Barn Newbie Learner is an unknown quantity at this point Learner's Avatar
    Join Date
    Sep 2009
    Posts
    3
    Rep Power
    3

    Hi,
    thanks for the reply and can someone help me out with the vb script please i dont know why it is not working????

    Thanks 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>
    

  4. #4
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Welcome to DeveloperBarn

    One thing I notice is your End If line. You have:
    Code:
    Endif
    
    and it should be:
    Code:
    End If
    
    Is there any particular reason you're not using JavaScript instead? client-side VBScript will only run in Internet Explorer.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  5. #5
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    Also, any particular reason you have chosen to learn programming with Classic ASP and VBScript when ASP.NET and VB.NET are clearly the intended direction from Microsoft? Classic ASP and VBScript are 'mature' technologies, meaning that MS isn't putting much, if any, effort in maintaining and expanding them.

    You can download a free Web development environment (Visual Web Developer) from Mircosoft -- as well as a free version of SQL Server (SQL Express).
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

+ Reply to Thread

Similar Threads

  1. Login Script to Stored Procedure
    By Centurion in forum ASP Development
    Replies: 13
    Last Post: June 17th, 2009, 01:18 PM
  2. Need a script made.
    By jpaytoncfd in forum PHP Development
    Replies: 2
    Last Post: June 12th, 2009, 08:00 PM
  3. Simple script to modify csv file
    By grae.uk in forum Windows Scripting
    Replies: 4
    Last Post: June 11th, 2009, 08:35 AM
  4. altering a script
    By Shem in forum JavaScript Programming
    Replies: 2
    Last Post: May 18th, 2009, 10:23 AM
  5. Basic Login Script (using MS Acesss)
    By BLaaaaaaaaaarche in forum ASP Code Samples
    Replies: 0
    Last Post: March 24th, 2008, 05:50 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO