本帖最后由 qdcaishen 于 2009-6-14 17:23 编辑
辛苦了半天做的,喜欢的拿去。
请教大家个问题:
怎样才能在搜索结果前显示分类名字呢?
把那个"更多"改成[分类目录]。一上午都没弄明白。来请教请教
相关网站:http://www.xiuchy.com
- <div class="box_r col_400 nl_for_sides" style="float:none;" stlye="width:400px;">
- <div class="search_bar">
- <h3>快速搜索</h3>
- <ul id="tab_search">
- <li class="current"><em onclick="secBoard('tab_search','searchlist',1)">标题</em></li>
- <li class="normal"><em onclick="secBoard('tab_search','searchlist',2)">内容</em></li>
- <li class="normal"><em onclick="secBoard('tab_search','searchlist',3)">作者</em></li>
- <li class="normal"><em onclick="secBoard('tab_search','searchlist',4)">百度</em></li>
- <li class="normal"><em onclick="secBoard('tab_search','searchlist',5)">Google</em></li>
- </ul>
- <div class="search_list">
- <div id="searchlist_1" class="current">
- <form action="{S_URL}/batch.search.php" method="post">
- <input id="search1" onclick="javascript:searchtxt('search1')" type="text" class="input_tx" size="22" name="searchkey" value="$searchkey" />
- <input type="hidden" name="searchname" id="searchname" value="subject" />
- <input type="submit" class="input_search" name="authorsearchbtn" value="搜索" /><br />
- <input type="hidden" value="news" name="type">
- <input type="hidden" name="authorsearch" value="true" />
- </form>
- </div>
- <div id="searchlist_2" class="normal">
- <form action="{S_URL}/batch.search.php" method="post">
- <input id="search2" onclick="javascript:searchtxt('search2')" type="text" class="input_tx" size="22" name="searchkey" value="$searchkey" />
- <input type="hidden" name="searchname" id="searchname" value="message" />
- <input type="submit" class="input_search" name="searchbtn" value="搜索" /><br />
- <input type="hidden" value="news" name="type">
- <input type="hidden" name="subjectsearch" value="true" />
- </form>
- </div>
- <div id="searchlist_3" class="normal">
- <form action="{S_URL}/batch.search.php" method="post">
- <input id="search3" onclick="javascript:searchtxt('search3')" type="text" class="input_tx" size="22" name="searchkey" value="$searchkey" />
- <input type="hidden" name="searchname" id="searchname" value="author" />
- <input type="submit" class="input_search" name="messagesearchbtn" value="搜索" /><br />
- <input type="hidden" value="news" name="type">
- <input type="hidden" name="messagesearch" value="true" />
- </form>
- </div>
-
- <div id="searchlist_3" class="normal">
- <form action="{S_URL}/batch.search.php" method="post">
- <input id="search3" name="searchname value="请输入关键字" class="input_tx" size="22" onMouseOver="this.focus()"
- onBlur="if (this.value =='') this.value='请输入关键字'" onFocus="this.select()" onClick="if
- (this.value=='请输入标题作者关键字') this.value=''">
- <input type="hidden" name="searchname" id="searchname" value="author" />
- <input type="submit" class="input_search" name="messagesearchbtn" value="搜索" /><br />
- <input type="hidden" value="news" name="type">
- <input type="hidden" name="messagesearch" value="true" />
- </form>
- </div>
-
- <script type='text/javascript' src='http://unstat.baidu.com/code/js/fyb_2.js'></script>
- <script>
- var frmact = new Array();
- var frmnm = new Array();
- var frmid = new Array();
- frmact[0] = "http://www.baidu.com/baidu";
- frmnm[0] = "网页";
- frmid[0] = "2";
- var fybClient1 = fybServer_2;
- var ch = "";
- var sts = '';
- var si = sts && sts.split(/(%3b)|;/i)[0];
- var defid =2;
- //new
- function changetab(idx)
- {
- for (i=0;i<frmact.length;i++) {
- if (i==idx) {document.getElementById('sitem_'+i).className="chon";}
- else {document.getElementById('sitem_'+i).className="ch";}
- }
- }
- //if (frmid[0] == "1") {var bd_idx=1;}else{var bd_idx=0;}
- var bd_idx=defid;
- for (var i = frmid.length - 1; i >= 0; i--) {
- if (frmid[i] == defid) {
- bd_idx = i;
- }
- }
- function bd_chg_idx(idx)
- {
- bd_idx=idx;
- //new
- changetab(idx);
- }
- function addhiddenEle(parentEle, childEleName, childEleValue)
- {
- for (var i=0; i < childEleName.length; i++) {
- var ur = document.createElement("input");
- ur.type = "hidden";
- ur.name = childEleName[i];
- ur.value = childEleValue[i];
- parentEle.appendChild(ur);
- }
- }
- function removeallhiddenEle(parentEle)
- {
- for (var i = parentEle.length - 1; i >= 0; i--) {
- var childEle = parentEle.elements[i];
- if(childEle.type == "hidden"){
- childEle.parentNode.removeChild(childEle);
- }
- }
- }
- function gowhere(formname)
- {
- var url;
- var idx = bd_idx;
- if (frmact[idx] == null || frmact[idx] == "") idx = "0";
- url = frmact[idx];
- removeallhiddenEle(formname);
- switch(frmid[idx]){
- case "1":
- var childEleName = new Array();
- var childEleValue = new Array();
- childEleName[0] = "cl";
- childEleValue[0] = "2";
- childEleName[1] = "ct";
- childEleValue[1] = "0";
- childEleName[2] = "rn";
- childEleValue[2] = "20";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "2":
- var childEleName = new Array();
- var childEleValue = new Array();
- childEleName[0] = "tn";
- childEleValue[0] = "leader0207_pg";
- childEleName[1] = "fyb";
- childEleValue[1] = "0";
-
- if(ch){
- childEleName.push("ch");
- childEleValue.push(ch);
- }
-
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "3":
-
- formname.word.name = "kw";
- break;
- case "4":
-
- var childEleName = new Array();
- var childEleValue = new Array();
- childEleName[0] = "ct";
- childEleValue[0] = "17";
- childEleName[1] = "pn";
- childEleValue[1] = "0";
- childEleName[2] = "rn";
- childEleValue[2] = "10";
- childEleName[3] = "tn";
- childEleValue[3] = "ikaslist";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "5":
- var childEleName = new Array();
- var childEleValue = new Array();
- childEleName[0] = "ct";
- childEleValue[0] = "134217728";
- childEleName[1] = "lm";
- childEleValue[1] = "-1";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "6":
- var childEleName = new Array();
- var childEleValue = new Array();
- childEleName[0] = "ct";
- childEleValue[0] = "201326592";
- childEleName[1] = "lm";
- childEleValue[1] = "-1";
- childEleName[2] = "cl";
- childEleValue[2] = "2";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "7":
- var childEleName = new Array();
- var childEleValue = new Array();
- childEleName[0] = "ct";
- childEleValue[0] = "17";
- childEleName[1] = "lm";
- childEleValue[1] = "0";
- childEleName[2] = "tn";
- childEleValue[2] = "baiduWikiSearch";
- childEleName[3] = "pn";
- childEleValue[3] = "0";
- childEleName[4] = "rn";
- childEleValue[4] = "0";
- childEleName[5] = "submit";
- childEleValue[5] = "search";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "8":
- return false;
- case "9":
- var childEleName = new Array();
- var childEleValue = new Array();
- childEleName[0] = "ct";
- childEleValue[0] = "301989888";
- childEleName[1] = "pn";
- childEleValue[1] = "0";
- childEleName[2] = "rn";
- childEleValue[2] = "20";
- childEleName[3] = "db";
- childEleValue[3] = "0";
- childEleName[4] = "s";
- childEleValue[4] = "0";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "10":
- var childEleName = new Array();
- var childEleValue = new Array();
- childEleName[0] = "f";
- childEleValue[0] = "ms";
- childEleName[1] = "rn";
- childEleValue[1] = "10";
- childEleName[2] = "tn";
- childEleValue[2] = "baidump3lyric";
- childEleName[3] = "ct";
- childEleValue[3] = "150994944";
- childEleName[4] = "lm";
- childEleValue[4] = "-1";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "11":
- var childEleName = new Array();
- var childEleValue = new Array();
- childEleName[0] = "ie";
- childEleValue[0] = "gb2312";
- childEleName[1] = "ct";
- childEleValue[1] = "1048576";
- childEleName[2] = "cl";
- childEleValue[2] = "3";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "12":
- var childEleName = new Array();
- var childEleValue = new Array();
- childEleName[0] = "tn";
- childEleValue[0] = "baiduyp";
- childEleName[1] = "ct";
- childEleValue[1] = "553648128";
- childEleName[2] = "rn";
- childEleValue[2] = "20";
- childEleName[3] = "a";
- childEleValue[3] = "-1";
- childEleName[4] = "lm";
- childEleValue[4] = "-1";
- childEleName[5] = "z";
- childEleValue[5] = "-1";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "13":
- var childEleName = new Array();
- var childEleValue = new Array();
- childEleName[0] = "tn";
- childEleValue[0] = "baiduchild";
- childEleName[1] = "cl";
- childEleValue[1] = "3";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "14":
- var childEleName = new Array();
- var childEleValue = new Array();
-
- childEleName[0] = "tn";
- childEleValue[0] = "baidujiaoyu";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "15":
-
- var childEleName = new Array();
- var childEleValue = new Array();
-
- childEleName[0] = "if";
- childEleValue[0] = "0";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "16":
- var childEleName = new Array();
- var childEleValue = new Array();
-
- childEleName[0] = "tn";
- childEleValue[0] = "baidubook";
- childEleName[1] = "ct";
- childEleValue[1] = "2097152";
- childEleName[2] = "si";
- childEleValue[2] = "book.baidu.com";
- childEleName[3] = "cl";
- childEleValue[3] = "3";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "17":
- var childEleName = new Array();
- var childEleValue = new Array();
-
- childEleName[0] = "tn";
- childEleValue[0] = "baiduguoxue";
- childEleName[1] = "ct";
- childEleValue[1] = "2097152";
- childEleName[2] = "si";
- childEleValue[2] = "guoxue.baidu.com";
- childEleName[3] = "cl";
- childEleValue[3] = "3";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "18":
- var childEleName = new Array();
- var childEleValue = new Array();
-
- childEleName[0] = "type";
- childEleValue[0] = "0";
- childEleName[1] = "sort";
- childEleValue[1] = "1";
- childEleName[2] = "entry";
- childEleValue[2] = "1";
- childEleName[3] = "region";
- childEleValue[3] = "0";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "19":
- var childEleName = new Array();
- var childEleValue = new Array();
-
- childEleName[0] = "tn";
- childEleValue[0] = "baidugov";
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- case "99":
- var childEleName = new Array();
- var childEleValue = new Array();
-
- childEleName[0] = "tn";
- childEleValue[0] = "leader0207_pg";
- childEleName[1] = "cl";
- childEleValue[1] = "3";
- childEleName[2] = "ct";
- childEleValue[2] = "2097152";
- childEleName[3] = "si";
- childEleValue[3] = si;
- childEleName[4] = "sts";
- childEleValue[4] = sts;
-
- if(ch){
- childEleName.push("ch");
- childEleValue.push(ch);
- }
- addhiddenEle(formname, childEleName, childEleValue);
- formname.word.name = "word";
- break;
- default:
- return false;
- }
- formname.action = url;
- return true;
- }
- </script>
-
- <div id="searchlist_4" class="normal">
- <form name="search_form" target="_blank" id="search_form" onsubmit="return gowhere(this)">
- <input id="word" name="word" value="请输入关键字" class="input_tx" size="22" onMouseOver="this.focus()"
- onBlur="if (this.value =='') this.value='请输入关键字'" onFocus="this.select()" onClick="if
- (this.value=='请输入关键字') this.value=''">
- <input type="submit" class="input_search" name="_si" id="_si" name="authorsearchbtn" value="搜索" />
- <br />
- </form>
- </div>
- <div id="searchlist_5" class="normal">
- <!-- Search Google -->
- <center>
- <script type="text/javascript"><!--
- google_ad_client = "pub-0";
- google_ad_format = "configurable_sdo";
- google_link_target = 2;
- google_color_bg = "ffffff";
- google_color_link = "000000";
- google_color_text = "000000";
- google_encoding = "GB2312";
- google_box_len = 31;
- google_logo_pos = "left";
- google_rs_pos = "right";
- google_ad_height = 30;
- google_ad_width = 500;
- //-->
- </script>
- <script type="text/javascript"
- src="http://pagead2.googlesyndication.com/pagead/show_sdo.js">
- </script>
- </center>
- <!-- Search Google -->
- </div>
- <div class="fyb"><script>document.write("<a href='http://www.baidu.com/s?tn=leader0207_pg&fyb=1&wd="+fybClient1[0]+(ch?"&ch="+ch:"")+"' target='_blank' >"+fybClient1[0]+"</a>");</script></div>
- <div class="fyb"><script>document.write("<a href='http://www.baidu.com/s?tn=leader0207_pg&fyb=1&wd="+fybClient1[1]+(ch?"&ch="+ch:"")+"' target='_blank' >"+fybClient1[1]+"</a>");</script></div>
- <div class="fyb"><script>document.write("<a href='http://www.baidu.com/s?tn=leader0207_pg&fyb=1&wd="+fybClient1[2]+(ch?"&ch="+ch:"")+"' target='_blank' >"+fybClient1[2]+"</a>");</script></div>
- <div class="fyb"><script>document.write("<a href='http://www.baidu.com/s?tn=leader0207_pg&fyb=1&wd="+fybClient1[3]+(ch?"&ch="+ch:"")+"' target='_blank' >"+fybClient1[3]+"</a>");</script></div>
- <div class="fyb"><script>document.write("<a href='http://www.baidu.com/s?tn=leader0207_pg&fyb=1&wd="+fybClient1[4]+(ch?"&ch="+ch:"")+"' target='_blank' >"+fybClient1[4]+"</a>");</script></div>
- <div class="fyb"><script>document.write("<a href='http://www.baidu.com/s?tn=leader0207_pg&fyb=1&wd="+fybClient1[5]+(ch?"&ch="+ch:"")+"' target='_blank' >"+fybClient1[5]+"</a>");</script></div>
- <div class="fyb"><script>document.write("<a href='http://www.baidu.com/s?tn=leader0207_pg&fyb=1&wd="+fybClient1[6]+(ch?"&ch="+ch:"")+"' target='_blank' >"+fybClient1[6]+"</a>");</script></div>
- </div>
- </div>
- </div>
- </div>
-
- <div id="searchlist_4" class="normal"><center>请输入最简短的关键字,中间不要加空格 如:梦到西瓜</center></div>
复制代码 |