Results 1 to 9 of 9

Thread: vbscript or javascript

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Location
    US, PA
    Posts
    79

    vbscript or javascript

    Can these be done in vbscript or do I have to use javascript

    1) How do I create a button, so that when pressed it calls a function.The function I want to write would be to save the data, or go back to the previous screen. How would I do that??

    2) Can I do validation on a text box to see if the user is entering numeric data??

    Thanks

    Reggie

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    VBscript will work only on IE, while javascript will work on IE and other browsers. (Provided the user has them enabled). You would use the onClick event to run a function when a button is pressed. You would have no problem doing data validation in either language.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Location
    US, PA
    Posts
    79
    JoshT,

    I wrote this code for the button, but for some reason it would not go into the function Update_Records().

    <INPUT name="Update_Records" onclick="Update_Records()" type="Button" value="Update Data">

    Function Update_Records_Onclick()

    Response.write "Message"

    End Function

  4. #4
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    You're mixing client and server side code. Do you want to execute your function on the server on on the client?
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Location
    US, PA
    Posts
    79
    Which Script runs faster?.

    What is the syntax for client side. How do I call a function from the client side??

  6. #6
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    <INPUT name="Update_Records" onclick="Update_The_Records()" type="Button" value="Update Data">

    Function Update_The_Records()
    Response.write "Message"
    End Function

    The first didnt work cuz' you called Update_Records. You couldve called Update_Records_Onclick or put nothing at all for it to work.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  7. #7
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    You won't be able to update a database from client side script. I would suggest changing your button to a submit and onsubmit, call your validation function, before the submit.

    You can have the form submit to the same page and put code in the beginning of the page that only runs if the form was submitted You could check the value of say Request.Form("MySubmit"). If it has a value, run the update database code.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  8. #8
    Lively Member
    Join Date
    Jan 2001
    Posts
    72

    to JoshT

    JoshT,

    It seems like you're always catching people mixing up client/server scripting. Haha, not bad!

  9. #9
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    It seems like you're always catching people mixing up client/server scripting. Haha, not bad!
    Yeah, it happens a lot. In real life, I've had fun trying to explain to certain people that you can dynamically generate client scripts with server scripts...
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

Posting Permissions

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



Click Here to Expand Forum to Full Width