Results 1 to 4 of 4

Thread: ASP variables and script variables

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 1999
    Posts
    50

    Question

    Hi guys,

    In my [main.asp] file at some point I have the following code:

    <script language='JavaScript'>

    NickName=document.Info.NickName;

    Application('Nick Name')=NickName <<------ doesn't work?
    .
    .
    .

    My problem is that I can't assign the value an ASP variable (server variable) to a script variable, my question how can solve this?

    Waiting for your appreciated answers,

    poor Wesam!

  2. #2
    Guest
    Remember ASP gets parsed before javascript. So when you assign the application asp variable a client side javascript value it will always be blank if they both reside in the same physical file.

  3. #3
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    If you are generating the server-side variable and need to just pass it into the page so it is available on the client side, just create the Javascript code using response.write statements.

    If you are trying to do the opposite, and assign something from the client side into a server-side variable, you will most likely need to either refresh the page using querystrings or use a form and submit the form to the same page and put server side code to handle if the page has been submitted.

    Hope that helps and.. well.. makes sense..

    /\/\onte96

  4. #4

    Thread Starter
    Member
    Join Date
    Feb 1999
    Posts
    50
    Thank you, I solved the problem.

Posting Permissions

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



Click Here to Expand Forum to Full Width