PDA

Click to See Complete Forum and Search --> : ASP variables and script variables


Wesam
Sep 6th, 2000, 12:01 PM
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!

Sep 7th, 2000, 12:27 AM
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.

monte96
Sep 7th, 2000, 12:35 AM
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

Wesam
Sep 7th, 2000, 03:00 AM
Thank you, I solved the problem.