新手请教:我写的页面间传值代码不知错在那里?
<form name= "form1 ">
<input name= "rq1 " type= "text " id= "rq1 " value= "2007-01-01 " >
<input name= "rq2 " type= "text " id= "rq2 " value= "2007-03-31 " >
<input name= "Submit " type= "button " value= "按钮 " onClick= "window.open( 'test1.asp?id1= <%=request.form( "rq1 ")%> &id2= <%=request.form( "rq2 ")%> ', 'newWindow ', 'menubar=no,scrollbars=no,resizable=no,width=800,height=380 ');return false; " >
为什么在test1.asp中取不出数?
<%
response.write Request.QueryString( "id1 ")
%>
<%
response.write Request.QueryString( "id2 ")
%>
------解决方案--------------------asp的代码是在那个onClick的javascript生成之前执行的,此时Request.Form为空,所以那个onClick就变成 "...test1.asp?id1=&id2= ... ",你表单嘛只要把form的action= "test1.asp " method= "GET ",onClick删掉,就可以在test1.asp中看到id1和id2了
------解决方案-------------------- <form name= "form1 ">
<input name= "rq1 " type= "text " id= "rq1 " value= "2007-01-01 " >
<input name= "rq2 " type= "text " id= "rq2 " value= "2007-03-31 " >
<input name= "Submit " type= "button " value= "按钮 " onClick= "window.open( 'test1.asp?id1= '+form1.rq1.value+ '&id2= '+form1.rq1.value+ ' ', 'newWindow ', 'menubar=no,scrollbars=no,resizable=no,width=800,height=380 ');return false; " >
</form>