网页制作实现网站Baidu,Google搜索的问题
我制作做了一个网站连接的百度搜索。 这搜索我自己做的。一个Textbox(输入关键字)一个是点击搜索按扭,两个单选按扭是连接Baidu和Google的搜索连接。
现在想请问高手。如何才能在Textbox里输入关键字。然后点搜索,可以根据你选择的搜索引擎,返回Baidu或Google上的搜索结果
望高手赐教!小弟感激![tk02]
<form name=form1 onSubmit=return(search4())>
<tr bgcolor="cornsilk">
<td width="81%" height="15" align=middle><p align="center">请输入关键字:
<input size=25 name=key>
<input type=submit value= 搜索 name=B2 >
<br>
<input name=nsns type=radio value=0 checked>
<a href="http://www.baidu.com/s?tn=ytf369_pg">百度</a>
<input name=nsns type=radio value=google>
<a href="http://www.google.com/intl/zh-CN/">Google</a>
</td>
</tr>
</form> 没那么简单,两者 charset 不同,百度是 gb2312,Google 是 utf-8
虽说 form 有 accept-charset 属性,ie 也认识,但提交时 ie 还是不买这属性的账,依然按 document 的 charset 提交。当然 document 的 charset 可以改变,但要是两次来回刷新页面,就变得愚不可耐了。
除非你用上 iframe [quote][bo]以下是引用 [un]reggy[/un] 在 2008-4-29 13:36 的发言:[/bo]
没那么简单,两者 charset 不同,百度是 gb2312,Google 是 utf-8
虽说 form 有 accept-charset 属性,ie 也认识,但提交时 ie 还是不买这属性的账,依然按 document 的 charset 提交。当然 document 的 charset 可以改变,但要是 ... [/quote]
谢谢楼上的朋友解答。我也看过用iframe的,那好像是连接了百度的一个页面,能不能在我上面代码的基础上修改一下可以实现呢?
或者有没有朋友可以帮忙实现呢?因为小弟初学,水平有限。请求高手大侠帮忙~!感激谢谢 譬如
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<form name=gsearch action=http://www.google.com... >
<input type=text name=q>
<input...>
...
<input type=submit>
</form>
iframe 管百度
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<form name=bsearch action=http://www.baidu.com... >
<input type=hidden name=q1>
<input type=hidden ...>
...
<input type=button onclick=fetch()>
</form>
iframe 中的 script
function fetch(){
document.bsearch.q1.value = parent.document.gsearch.q.value;
...
document.bsearch.submit();
}
页:
[1]
