对面的页面时aspx的 读的的url的querystring。
在断点调试的时候我发现form的action的值中url后面有我想要的querystring了,但是真正走过去的时候去发现地址栏里的url没有qstr
function frm_submit()
{
var kt=(document.getElementById('KeywordType')).value;
var kw=(document.getElementById('Keyword')).value;
formSearch.action="Search.aspx?KeywordType=" + kt + "&Keyword=" + kw;
//formSearch.submit();
}
</script>
<!--/init code-->
</center>
<center>
<form id="formSearch" action="Search.aspx" method="get" onsubmit="return frm_submit()">
<select id="KeywordType">
<option value="1" title="商家">商家</option>
<option value="2" title="商品">商品</option>
</select><input id="Keyword" type="text" value="请输入关键词" onfocus="javascript:this.value='';this.focus()"/>
<input id="button" type="submit" value="找一下"/> <input type="reset" value="重置" />
</form>
</center>还尝试了另外的方法 比如在button的onclick事件里运行js修改action,结果也不是我预计那样 我对表单提交的什么地方产生误解了,希望高手能帮我指出问题所在以及以这种方式解决问题的方法。谢了
在断点调试的时候我发现form的action的值中url后面有我想要的querystring了,但是真正走过去的时候去发现地址栏里的url没有qstr
function frm_submit()
{
var kt=(document.getElementById('KeywordType')).value;
var kw=(document.getElementById('Keyword')).value;
formSearch.action="Search.aspx?KeywordType=" + kt + "&Keyword=" + kw;
//formSearch.submit();
}
</script>
<!--/init code-->
</center>
<center>
<form id="formSearch" action="Search.aspx" method="get" onsubmit="return frm_submit()">
<select id="KeywordType">
<option value="1" title="商家">商家</option>
<option value="2" title="商品">商品</option>
</select><input id="Keyword" type="text" value="请输入关键词" onfocus="javascript:this.value='';this.focus()"/>
<input id="button" type="submit" value="找一下"/> <input type="reset" value="重置" />
</form>
</center>还尝试了另外的方法 比如在button的onclick事件里运行js修改action,结果也不是我预计那样 我对表单提交的什么地方产生误解了,希望高手能帮我指出问题所在以及以这种方式解决问题的方法。谢了
<form action="checkUser.html" method="GET">
<input type="hidden" name="opt" value="中文"/>
<input type="text" name="username" value="yyy"/>
<input type="text" name="age" value="zzz"/>
<input type="submit" value="submit"/>
</form> 实际上http request是这样的:
GET /hello/checkUser.html?opt=%E4%B8%AD%E6%96%87&username=yyy&age=zzz HTTP/1.1
Referer: http://localhost:8000/hello/index.html
Accept: */*
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
Host: localhost:8000
Connection: Keep-Alive
Cookie: JSESSIONID=BBBA54D519F7A320A54211F0107F5EA6参考:
http://blog.csdn.net/darxin/archive/2009/12/05/4944225.aspx
<input id="button" type="button" value="找一下" onclick="A()"/>
window.location.href="Search.aspx?KeywordType=" + kt + "&Keyword=" + escape(kw);