朋友们好,我想把各个频道的搜索功能整合到一起,应该怎么做啊,我现在各个频道的搜索都已经做好,但在首页上,我想做一个下拉菜单,然后点搜索可以搜索相关频道的内容的.
或者做成那种,输入关键字后,点相应频道名称就可以进行搜索的那种.
请各位大虾\朋友,一定帮我一下,谢谢哦.
[此贴子已经被作者于2005-11-26 16:58:48编辑过]
谢谢各位了,我都试验过了,但我太菜了。
所以再请大家帮我看看,我现在的代码是这样的,(下边)。我想把他们整合到一起,最好就是用下拉菜单的,能否帮我修改一下,谢谢。
我调用的 result.asp 分别在不同的频道,数据表也不一样。在各自的频道下都可以很好地实现搜索。
代码如下:
<!--#include file="sql.asp" -->
<!--#include file="md5.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<style type="text/css">
<!--
.style1 {color: #2A0000}
-->
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>云南视窗频道内搜索</title>
</head>
<script LANGUAGE="javascript">
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
function check()
{
if(checkspace(document.Form1.keyword.value)) {
document.Form1.keyword.focus();
alert("请输入您要查询的关键字!");
return false;
}
document.Form1.submit();
}
</script>
<body>
<table width="799" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td width="799" height="23"><p class="style1"> 欢迎您使用<云南视窗>站内搜索引擎.请您在对应的频道内搜索您需要资料,<巅峰文化><人才招聘>的详细内容搜索请您到频道内搜索,谢谢!</p></td>
</tr></table>
<!--用post方法提交表单 -->
<form name="Form1" method="post" action="yn/result.asp" target="_blank">
<table width="158" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="88" height="23"><input name="keyword" type="text" id="keyword"></td>
<td width="70"> <input type="submit" value="《走遍云南》中搜索" name="Submit" onMouseOver ="this.style.backgroundColor='#ffffff'" onMouseOut ="this.style.backgroundColor='#EAEAF4'" onClick="return check();" title="搜索">
</td>
</tr>
</table>
</form>
<form name="Form1" method="post" action="qy/result.asp" target="_blank">
<table width="158" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="88" height="23"><input name="keyword" type="text" id="keyword"></td>
<td width="70"> <input type="submit" value="《企业之窗》中搜索" name="Submit" onMouseOver ="this.style.backgroundColor='#ffffff'" onMouseOut ="this.style.backgroundColor='#EAEAF4'" onClick="return check();" title="搜索">
</td>
</tr>
</table>
</form>
<form name="Form1" method="post" action="dc/result.asp" target="_blank">
<table width="158" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="88" height="23"><input name="keyword" type="text" id="keyword"></td>
<td width="70"> <input type="submit" value="《地产纵横》中搜索" name="Submit" onMouseOver ="this.style.backgroundColor='#ffffff'" onMouseOut ="this.style.backgroundColor='#EAEAF4'" onClick="return check();" title="搜索">
</td>
</tr>
</table>
</form>
<form name="Form1" method="post" action="hz/result.asp" target="_blank">
<table width="158" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="88" height="23"><input name="keyword" type="text" id="keyword"></td>
<td width="70"> <input type="submit" value="《云南会展》中搜索" name="Submit" onMouseOver ="this.style.backgroundColor='#ffffff'" onMouseOut ="this.style.backgroundColor='#EAEAF4'" onClick="return check();" title="搜索">
</td>
</tr>
</table>
</form>
<form name="Form1" method="post" action="sc/result.asp" target="_blank">
<table width="158" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="88" height="23"><input name="keyword" type="text" id="keyword"></td>
<td width="70"> <input type="submit" value="《在线商城》中搜索" name="Submit" onMouseOver ="this.style.backgroundColor='#ffffff'" onMouseOut ="this.style.backgroundColor='#EAEAF4'" onClick="return check();" title="搜索">
</td>
</tr>
</table>
</form>
<form name="Form1" method="get" action="wh/search.asp" target="_blank">
<table width="158" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="88" height="23"><input name="keyword" type="text" id="keyword"></td>
<td width="70"> <input type="submit" value="《巅峰文化》中搜索" name="Submit" onMouseOver ="this.style.backgroundColor='#ffffff'" onMouseOut ="this.style.backgroundColor='#EAEAF4'" onClick="return check();" title="搜索">
</td>
</tr>
</table>
</form>
</body>
</html>
<!--#include file="sql.asp" -->
<!--#include file="md5.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<style type="text/css">
<!--
.style1 {color: #2A0000}
-->
</style>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>云南视窗频道内搜索</title>
</head>
<script LANGUAGE="javascript">
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
function check()
{
if(checkspace(document.Form1.keyword.value)) {
document.Form1.keyword.focus();
alert("请输入您要查询的关键字!");
return false;
}
document.Form1.submit();
}
</script>
<body>
<table width="799" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td width="799" height="23"><p class="style1"> 欢迎您使用<云南视窗>站内搜索引擎.请您在对应的频道内搜索您需要资料,<巅峰文化><人才招聘>的详细内容搜索请您到频道内搜索,谢谢!</p></td>
</tr></table>
<table width="300" height="30" border="0" align="center" cellpadding="0" cellspacing="0">
<form name="form1" method="post" action="yn/result.asp" target="_blank"> <tr>
<td><input name="keyword" type="text" id="keyword" size="15"></td>
<td><select name="act" id="act" onChange="form1.action=this.value">
<option value="yn/result.asp" selected>走遍云南</option>
<option value="qy/result.asp">企业之窗</option>
<option value="dc/result.asp">地产纵横</option>
<option value="hz/result.asp">云南会展</option>
<option value="sc/result.asp">在线商城</option>
<option value="wh/search.asp">巅峰文化</option>
</select></td>
<td>
<input type="submit" name="Submit2" value="开始搜索">
</td>
</tr></form>
</table>
</body>
</html>