站内外搜索对一个网站有很重要的意义,接下来为大家介绍下phpcms v9实现站内外搜索的代码,感兴趣的朋友可以参考下哈
复制代码
代码如下:<form name="search_form1" target="_blank" onsubmit="return go(this)">
<input name="q" id="q" size="30" value="请输入关键字" onMouseOver="this.focus()" onBlur="if (value ==''){value='请输入关键字'}" onFocus="this.select()" onClick="if(this.value=='请输入关键字')this.value=''">
<INPUT name="word" type="hidden" value=0>
<INPUT name="myselectvalue" type="hidden" value=0>
<INPUT name="tn" type="hidden" value="sayyes">
<INPUT name="cl" type="hidden" value="3">
<input type="hidden" name="m" value="search"/>
<input type="hidden" name="c" value="index"/>
<input type="hidden" name="a" value="init"/>
<input type="hidden" name="typeid" value="1"/>
<input type="hidden" name="siteid" value="1"/>
<INPUT CHECKED name="myselect" onclick=javascript:this.form.myselectvalue.value=0; type=radio value=0>
<FONT color=#0000cc style="FONT-SIZE: 12px">互联网</FONT>
<INPUT name="myselect" onclick=javascript:this.form.myselectvalue.value=1; type=radio value=1>
<FONT color=#ff0000 style="FONT-SIZE: 12px">站内</FONT>
<input type="submit" value="搜索">
</form>
<SCRIPT language=javascript>
<!--
function go(formname)
{
var url = "http://www.baidu.com/baidu";
formname.method = "get";
if (formname.myselectvalue.value == "1") {
url="{APP_PATH}index.php";
}
document.search_form1.word.value = document.search_form1.q.value;
formname.action = url;
return true;
}
//-->
</SCRIPT>