How Can You Output ASP Values in JavaScript?

Results 1 to 2 of 2

Thread: How Can You Output ASP Values in JavaScript?

  1. #1
    Dalj Guest

    Default How Can You Output ASP Values in JavaScript?

    Hi,<BR><BR>I am trying to read values from a Database, which i have managed, but want to output them into come javascript.<BR><BR>If you know how, can you please mail me an example...<BR><BR><BR><BR>Regards

  2. #2
    Join Date
    Dec 1969

    Default RE: How Can You Output ASP Values in JavaScript?

    I am assuming you meant that you want the output to be used in a separate Javascript, as opposed to you want to program your asp using the Javascript language but do not know how.<BR><BR>Let&#039;s say that you want to output a variable from your database to be a value used in a javascript if statment. Let your application download the value to a recordset and then assign it to a variable named var1. Your script would then look something like this:<BR><BR>&#060;script language="Javascript"&#062;<BR>function test(somevalue){<BR>if (somevalue == &#060;%=var1%&#062;)}<BR>...commands...<BR>}<BR>}< BR>&#060;/script&#062;<BR><BR>The &#060;%=var1%&#062; writes the value of var1 right into the code. The asp is in essense writing your script for you. When someone looks at the source through a browser it will look like you hardcoded the value yourself.<BR> <BR>As far as I know this can only be done with Client-side scripts. I&#039;m not sure how you would go about doing the same for a server-side.<BR><BR>If this is not what you had in mind, please post again and try to be as specific as possible.

Posting Permissions

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