只需一步,快速开始
<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center"> <form method="post" action="search.php?orderby=lastpost&ascdesc=desc&searchsubmit=yes"> <tr> <td width="65%"> </td> <td style="vertical-align:middle; height:40px;" width="20%">关键字:<input type="text" style="border:solid 1px #2D559A; background-color:#F5FAFE;" id="srchtype" name="srchtxt"/> </td> <td width="10%" valign="middle">按<select style="border:solid 1px #2D559A; background-color:#F5FAFE;" onchange="changeSearchText(this);"><option value="0">帖子标题</option><option value="1">作 者</option></select></td> <td width="5%" valign="middle"><input type="image" src="http://www.025bbs520.com/images/search_ico.gif"/></td> </tr> </form> </table> <script language="javascript"> //切换下拉菜单改变搜索模式函数 function changeSearchText(obj) { var sNum = obj.options[obj.selectedIndex].value; if(sNum == 0) { document.getElementById("srchtype").name="srchtxt"; } else if(sNum == 1) { document.getElementById("srchtype").name="srchuname"; } else { alert(" 抱歉,系统错误!\n现在将自动转入按【帖子标题】搜索模式!"); document.getElementById("srchtype").name="srchtxt"; } } //检测搜索框内是否输入关键字 function checkSearchData() { if(document.getElementById("srchtype").value.trim() == "") { alert("搜索的关键字不能为空!"); document.getElementById("srchtype").select(); return false; } } //Js的trim函数开始 String.prototype.trim=function(){ return this.replace(/(^\s*)|(\s*$)/g, ""); } String.prototype.ltrim=function(){ return this.replace(/(^\s*)/g,""); } String.prototype.rtrim=function(){ return this.replace(/(\s*$)/g,""); } //Js的trim函数开始 </script>
使用道具 举报
本版积分规则 发表回复 回帖后跳转到最后一页
手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )
GMT+8, 2024-11-16 08:12 , Processed in 0.042445 second(s), 3 queries , Gzip On, Redis On.
Powered by Discuz! X3.4
Copyright © 2001-2023, Tencent Cloud.