No announcement yet.

Calling VBScript function from javascript

  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling VBScript function from javascript

    I am not sure if I can call a vbscript function from within a javascript function. I am doing a quiz, the responses of which are constantly collected in an array. At the end of the quiz I want to store the responses into an Access database. For the database part I have a vbscript function. The question is whether I can call that vbscript function from the javascript function. If so what should be the format/syntax.

  • #2
    if your doing this in asp, and vbscript is your server side code of choice, there is no need to try to 'call' the script. Simply submit your form to the action.asp page and let the server side vbscript do as it is instructed.

    Sounds like your caught up with trying to learn asp in a hurry. Might I suggest: ASP weekend crash course. You can find it at any major bookseller, and it will provide you with the skills you need to get the job done. Also, is a good, free ASP hosting service that offers, among other things, free access db's and tutorials in ASP and SQL.


    • #3
      Depends on what you mean by 'vbscript function'.
      If you want to call a function or subroutine you've written in vbscript, then just invoke it from javascript:

      If you want to use one of the native VB functions, like say len, or msgbox, then wrap it in your own function:
      <script language="vbscript">
      Function myTrim(str)
         myTrim = Trim(str)
      End Function
      <script language="javascript">
        var excessString = "  Leading & Trailing Spaces    "
        var trimString = myTrim(excessString)
      Jon Hanlon