Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    16

    Thumbs down Unanswered: how to access ASP variable through javascript

    plz can any buddy tell me the answr for ???
    tanks in advance

  2. #2
    Join Date
    Feb 2003
    Location
    Denver, CO
    Posts
    34
    <script language="JavaScript">
    var javaScriptVar = <%=AspVar%>
    </script>

  3. #3
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    And here's a little more info about mixing server-side ASP (which gets processed first) with client-side JavaScript.

    As already mentioned by Wigz it's easy to use the value of a VBScript variable in JavaScript:
    document.writeln('<%= MyVBScriptVariable %>');

    Or here is an example which puts the value of a VBScript variable into a JavaScript alert box:
    Response.Write "<script language='JavaScript'>alert('The value is " & MyVBScriptVariable & "');</script>"

    But to send the value of a JavaScript variable to VBScript, well that's another story. You could have the JavaScript fill in a hidden form field and then post the form. That way VBScript can pick up the value of the hidden form field with Request.Form("MyFieldName")
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

Posting Permissions

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