problem in passing java script variable to asp page
Hi,
My asp page has a dropdown box .When a value is selected in that,it calls a javascript function in which i have to catch the value of that selecteditem of dropdown box.This value should be passed to asp page so that a query is run with that and a textbox is populated with the result of that query.following is the code for that.
When i use the following code thre are many problems with that.For the first time when i select something from the dropdown box, nothing is getting displyed and from the second time,data is being displayed in the textbox....but
immediately the web page is getting reloaded again and all the data is lost.
Please help me in this....
<%@ LANGUAGE="VBSCRIPT" %>
sub showform
</SCRIPT>
<TITLE>SVR StartDate Selection</TITLE>
</HEAD>
<BODY >
<FORM method=post name=f1 ID="Form1">
function OOchange()
{
var Campus="";
if(document.f1.Campus.options[document.f1.Campus.selectedIndex].value)
{
Campus=document.f1.Campus.options[document.f1.Campus.selectedIndex].value;
<!--#include File="../inc/LSDevConn.asp"-->
<%
if request.querystring("Campus") <> "" then
'response.Write("hi")
'response.End
MYSQL2="Select distinct substring(collector_name,13,5) AS Code from svr_compare where substring(collector_name,1,4)= (select Collector_Code from CampCollCode where Division='"& request.QueryString("Campus")& "')"
Set MyRs2=MyConn.Execute(MySQL2)
Dim str
str=MyRS2("Code")
MyRS2.MoveNext
Do While NOT MyRS2.EOF
str=str & "," & MyRS2("Code")
MyRS2.MoveNext
loop
end if
%>
<TR id="hidden_Team_Auto" style="display:none;">
<TD align=left height="48">
<INPUT type=text name=TeamNumAuto maxlength=25 size=15 value= "<% =str %>" ID="Text1">
</TD>
</TR>
The javascript you are running is client-side and the asp is server-side.
Also, you haven't exactly explained what you are trying to do, and the form code (select, option html tags) are missing from your request, so we can't tell what you are doing.
i think it is copying error, because there are errors in the code (the page won't run with these errors) for example: the script tags are out of place etc
Bookmarks