不知我能否表达清楚。一个search.aspx页面用来做搜索,别的页面提交get到search.aspx,search.aspx页面还可以允许浏览者再次搜索,问题是没有源码, 不能写在服务器端,只能通过脚本解决,我是这样写的:<script>function noFormGoSearch(){ var t = document.getElementById("SearchItem").value; var v = trim(document.getElementById("Keyword").value); if(v.length > 100){ alert("您输入的关键字过长!"); return false; } if(v == "" || v.substring(0,3) =="请输入") { alert("请输入关键字!"); return false; } var url = "/search.aspx?t="+t+"&q="+encodeURI(v); window.open(url);}</script><input tabindex="1" type="text" id="Keyword" value="" onfocus="this.value=''" style="width: 200px" /> <select id="SearchItem" name="SearchItem"> <option value="seller">供应信息</option> <option value="buyer">求购信息</option> </select> <input tabindex="2" type="submit" class="searchbtn" value="搜 索" onclick="return noFormGoSearch()" />用起来倒是可以,问题是window.open让我很不爽,而且浏览者要打开一个新的窗口,用户体验也不好,怎么样做才能只在本页进行搜索呢?
- 2 回答
- 0 关注
- 455 浏览
添加回答
举报
0/150
提交
取消