PDA

Click to See Complete Forum and Search --> : jscript -> asp


richy
Mar 1st, 2001, 06:01 AM
I have a value in my JavaScript but I need my ASP code on the same page to be able to look at this value, but I can't get it to.
For example, I have the following JavaScript code:

<SCRIPT LANGUAGE=JAVASCRIPT>
thisvalue="bob";
alert(thisvalue);
</SCRIPT>


<%
// i need to find out the value of thisvalue, but i can't
%>

Can anybody tell me of a way of getting this value, when it's on the same page.

Kagey
Mar 1st, 2001, 07:52 PM
asp is executed on the server, and javascript is executed at the client. therefore, asp cant read javascript variables, but you can pass an asp variable to javascript like this:

<%
aspvalue = "bob"
%>

<SCRIPT LANGUAGE=JAVASCRIPT>
thisvalue="<%=aspvalue%>";
alert(thisvalue);
</SCRIPT>

richy
Mar 2nd, 2001, 03:34 AM
i don't suppose any one has any ideas as to work around this then as i've been through 3 different ideas...

there's a menu in a side bar on a left frame which has a drop downlist on as well. the links on the left hand bar, when selected, then change the location in the right hand frame. this page then needs to be able to get the drop downlist option that the user has selected. is there anyway of doing this because i've tried setting the location of the right frame from the left frame, which doesn't refresh and the original version of getting the value from the left bar in the right bar by javascript, but the above problem arises.