SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How do I pass a javascript variable in vbscript?

    Im using the onchange event for a dropdown list to change SQL statements based on the index of that dropdown chosen. For example I have a function like this for my onchange event of the drop down list.

    <script type="text/javascript">

    function listboxchange(index)

    declare connection ...
    <%
    SQL = "Select * FROM `mytable` WHERE `Field1` = ' "%>index<%" ' "

    make connection with SQL statement...
    %>

    Im trying to pass the javascript variable "index" into the SQL statement but its not working. Am I using the wrong syntax?

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2011
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I read around and it appears I cant directly do this. I have to use hidden fields? Can someone confirm this?

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ral1239 View Post
    I read around and it appears I cant directly do this. I have to use hidden fields? Can someone confirm this?
    JavaScript doesn't know of the existence of VBScript, and vice-versa. Never the twain shall meet, except via common intermediaries.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


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
  •