#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Posts
    1
    Rep Power
    0

    Arrow


    If I have declared a variable and it has a value set within a VBScript is there some way that a JavaScript could reference that variable?

    I was thinking maybe having the JS somehow call a VBS function but I'm unsure about that.

    Thanks,
    DK
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Location
    Stockholm - Sweden
    Posts
    18
    Rep Power
    0

    Thumbs down


    Hi!
    My answer is: Probably not. (please prove me wrong)
    You can acces the value of the VBscript varaible and add it to the javascript variable like:

    javaScrVariable = <%=VBscrVariable%>
    or
    javaScrVariable = "<%=VBscrVariable%>"
    for strings.

    Also I guess you´re using VBscript as ASP which runs on the server, before the page is shown in the browser. In this way, the variable won´t really exist when it reaches the browser.

    Tell me if I´ve got it all wrong.

    Regards
    Bjorn
  4. #3
  5. No Profile Picture
    Señor Member
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2000
    Posts
    1,157
    Rep Power
    37

    Thumbs down I concur.


    JavaScript can't access a variable in VBScript and vice versa. This is because the difference between client-side and server-side scripting.

    However, you can access the value of a variable
    by printing it (<%=variable%>), or (<%Response.Write(variable)%>).

IMN logo majestic logo threadwatch logo seochat tools logo