如下可以配置在多页面上,取最后的input内容
<input name="keyword" type="text" placeholder="请输入关键字" id="keyword" value="<%=keyword %>" onkeydown="entersearch()"><input type="button" onclick="search()">
<script type="text/javascript">
function search() {
window.location.href = 'Product.html?keyword=' + $.trim($('[name="keyword"]').last().val());
}
function entersearch() {
var event = window.event || arguments.callee.caller.arguments[0];
if (event.keyCode == 13) {
search();
}
}
</script>
注意在 <form id="form1" runat="server">
下面加 <input style="display:none"/>
<form id="form1" runat="server">
<input style="display:none"/>
</form>
或者脚本放 <form id="form1" runat="server">
之外,才能生效