Passing server variable to client side script

Results 1 to 4 of 4

Thread: Passing server variable to client side script

  1. #1
    Chad Tanner Guest

    Default Passing server variable to client side script

    I am trying to pass server variables to the client. I am pulling information from a database on the server side and I would like to pass these variables to be used in the client side script. Can this be done? How?<BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    190

    Default RE: Passing server variable to client side script

    Reference the variable just like you would in html... e.g.:<BR><BR>&#060;SCRIPT language=javascript&#062;<BR>var something = &#060;% =myvar %&#062;;<BR>&#060;/SCRIPT&#062;<BR><BR>HTH

  3. #3
    Chad Tanner Guest

    Default RE: Passing server variable to client side script

    In my server side scripting I made a variable MyString = Blah, Blah, Blah. <BR><BR>If I take this variable and put it into the HTML like this:<BR>&#060;Script langauge = vbscript&#062;<BR>data = &#060;%= MyString %&#062;<BR>&#060;/Script&#062;<BR>Should this work?<BR>To see if it works, I am trying to get the variable that is passed to show up in a message box when a button is pushed.<BR>Does all this client side scripting go inside the header tags?

  4. #4
    Join Date
    Dec 1969
    Posts
    190

    Default RE: Passing server variable to client side script

    The script can realistically go wherever you want (there are exceptions), but you my as well keep it in &#060;HEAD&#062; just to keep it organized. I&#039m assuming you know, but client-side vbscript only works in IE... You might be better off using Javascript<BR><BR>HTH<BR><BR>chad


Posting Permissions

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