Global Variable

Results 1 to 2 of 2

Thread: Global Variable

  1. #1
    Join Date
    Dec 1969

    Default Global Variable

    Hi, I wondered if there is a way I could have a global variable where both my client and server can be able to access it.

  2. #2
    Ritesh Guest

    Default RE: Global Variable

    Global is a can have a variable that is available to you in different scopes of the same "nature" ie either client or server, but not both.<BR>If you want to use a server side variable on the client, you need to use a hidden field and populate its value before displaying the page like:<BR><BR>&#060;form name=form1&#062;<BR>&#060;input type=hidden name=var_client value=&#060;%=var_server%&#062;&#062;<BR>&#060;/form&#062;<BR><BR>now to access that server variable on the client side you simply do:<BR>&#060;script language=javascript&#062; or maybe vbscript<BR>var_client_retrieve = form1.var_client.value<BR><BR>//do something with the variable...<BR><BR>and it need not be a global variable...any simple variable with the page scope will work fine.<BR><BR>

Posting Permissions

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