尘封在信箱里很久的JavaScript集成搜索的小例子。偶然翻了出来,重新整理了一下,在firefox和IE下测试居然通过。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<!--<meta http-equiv="Content-Type" content="text/html; charset=utf-8">-->
<title>集成搜索</title>
<script type="text/javascript">
<!--//
//选择所有对象
//function selectAll(obj){
// for (var i=0; i<obj.elements.length; i++) {
// var elem = obj.elements[i];
// if (elem.name!="all") {
// elem.checked = obj.all.checked;
// }
// }
//}
function search(checkboxName){
var mp31, mp32;
var tom1, tom2;
var sina1, sina2;
var sohu1, sohu2;
var baidu1, baidu2;
var sbox1, sbox2;
var flash1, flash2;
var yahoo1, yahoo2;
var google1, google2;
var netEase1, netEase2;
var text;
var noEngin;
var haveText;
noEngin = true;
haveText = true;
text = checkboxName.text.value;
if (text=="") {
alert("请输入搜索内容!");
haveText = false;
}
mp31 = checkboxName.mp3.checked;
mp32 = "http://mp3search.baidu.com/wstsearch?tn=baidump3&ct=134217728&word="+text;
if (mp31){
noEngin = false;
if (haveText){
newWin = window.open(mp32, "mp3","toolbar,location,directories,status,menubar,scrollbars,resizable=1");
}
}
tom1 = checkboxName.tom.checked;
tom2 = "http://sms2.ctn.com.cn/smslist/smsearch.php?user_id=67&inc=3&keyword="+text;
if (tom1){
noEngin = false;
if (haveText){
newWin = window.open(tom2, "tom","toolbar,location,directories,status,menubar,scrollbars,resizable=1");
}
}
sina1 = checkboxName.sina.checked;
sina2 = "http://search.sina.com.cn/cgi-bin/search/search.cgi?_searchkey="+text;
if (sina1){
noEngin = false;
if (haveText){
newWin = window.open(sina2, "sina","toolbar,location,directories,status,menubar,scrollbars,resizable=1");
}
}
sohu1 = checkboxName.sohu.checked;
sohu2 = "http://site.search.sohu.com/sitesearch.jsp?key_word="+text;
if (sohu1){
noEngin = false;
if (haveText){
newWin = window.open(sohu2, "sohu","toolbar,location,directories,status,menubar,scrollbars,resizable=1");
}
}
baidu1 = checkboxName.baidu.checked;
baidu2 = "http://www1.baidu.com/baidu?myselectvalue=0&tn=net900&word="+text;
if (baidu1){
noEngin = false;
if (haveText){
newWin = window.open(baidu2, "baidu","toolbar,location,directories,status,menubar,scrollbars,resizable=1");
}
}
sbox1 = checkboxName.sbox.checked;
sbox2 = "http://union.3721.com/search_result.htm?oid=&e=&pid=S_cn76_2605&fw=union&argse=new3721&name="+text;
if (sbox1){
noEngin = false;
if (haveText){
newWin = window.open(sbox2, "sbox","toolbar,location,directories,status,menubar,scrollbars,resizable=1");
}
}
flash1 = checkboxName.flash.checked;
flash2 = "http://flash.baidu.com/wstsearch?tn=flash&ct=33554432&word="+text;
if (flash1){
noEngin = false;
if (haveText){
newWin = window.open(flash2, "flash","toolbar,location,directories,status,menubar,scrollbars,resizable=1");
}
}
yahoo1 = checkboxName.yahoo.checked;
yahoo2 = "http://cn.search.yahoo.com/search/cn?p="+text;
if (yahoo1){
noEngin = false;
if (haveText){
newWin = window.open(yahoo2, "yahoo","toolbar,location,directories,status,menubar,scrollbars,resizable=1");
}
}
google1 = checkboxName.google.checked;
google2 = "http://google.cn76.com/search?hl=zh-CN&q="+text;
if (google1){
noEngin = false;
if (haveText){
newWin = window.open(google2, "google","toolbar,location,directories,status,menubar,scrollbars,resizable=1");
}
}
netEase1 = checkboxName.netEase.checked;
netEase2 = "http://nisearch.163.com/Search?q="+text;
if (netEase1){
noEngin = false;
if (haveText){
newWin = window.open(netEase2, "netEase","toolbar,location,directories,status,menubar,scrollbars,resizable=1");
}
}
if (noEngin) {
alert("请选择搜索引擎!");
}
}
//-->
</script>
</head>
<body>
<table style="width:760px; background-color: #FFFF00; layer-background-color: #CCCCCC; border: 1px none #000000">
<tr>
<td>
<font style="FONT-SIZE:9pt">集成搜索
</td>
<td>
<form name="engines" onSubmit="search(engines)">
<input style="background-color: fdf3d1; border: 1px solid #fbb723" name="text" size="10" maxlength="200" value="">
<input type="button" style="background-color:#ffffff;border-bottom:red 1px solid;border-left:red 1px solid;border-right:red 1px solid;border-top:red 1px solid;color:#000000;font-size:9pt" value="搜索" name="Submit" onClick="search(engines)">
<font style="font-size:9pt">
<input type="checkbox" name="baidu" checked="checked">百度
<input type="checkbox" name="google" checked="checked">Google
<input type="checkbox" name="yahoo">雅虎
<input type="checkbox" name="sina">新浪
<input type="checkbox" name="sohu">搜狐
<input type="checkbox" name="netEase">网易
<input type="checkbox" name="sbox">网络实名
<input type="checkbox" name="tom">手机铃声
<input type="checkbox" name="flash">FLASH
<input type="checkbox" name="mp3">MP3
</font>
</td>
</form>
</tr>
</table>
</body>
</html>
附件:集成搜索
分享到:
相关推荐
进入"Eclipse Marketplace",搜索"JavaScript Development Tools",然后按照提示进行安装。 安装完JDT后,Eclipse会提供一个专门的JavaScript编辑器,支持语法高亮、代码完成和错误检查。在创建新的项目时,选择...
在本主题中,我们将探讨如何在jQuery下拉框(Select元素)中集成搜索功能,以便用户能更高效地找到所需选项。这个功能在大型数据集或分类繁多的下拉菜单中尤其有用。 首先,我们需要理解jQuery的基本用法。jQuery...
例如,你可以添加一个输入框让用户输入他们感兴趣的股票代码,然后根据输入实时搜索和显示股票信息。还可以添加图表库,如Chart.js或D3.js,来绘制股票的价格走势,帮助用户更好地理解市场动态。 在处理实时数据时...
在实际应用中,还需要考虑搜索结果的排序、分页、错误处理、性能优化等细节,以及可能需要与后台框架如ASP.NET MVC或ASP.NET Core的深度集成。通过不断学习和实践,你可以创建出更加智能、高效的站内搜索功能,提升...
在本文档中,我们讨论了如何使用JavaScript编程来实现一个集成多种搜索引擎的“搜索引擎大全”功能。这个功能允许用户在一处输入查询关键字,并选择他们偏好的搜索引擎进行搜索,无需逐个访问各个搜索引擎网站。 ...
在“javascript经典特效---同时多种搜索引擎.rar”这个压缩包中,我们重点探讨的是如何利用JavaScript来创建和集成多种搜索引擎,为用户提供便捷的搜索体验。 在HTML文件“同时多种搜索引擎.htm”中,我们可以预期...
标题 "给自己的网站集成搜索引擎收录查询功能" 描述了一个个人站长如何通过技术手段解决日常查询网站搜索引擎收录情况的繁琐工作。这一过程涉及到多个IT领域的知识点,包括网站开发、API接口利用、前端交互以及数据...
Wade是一款小巧而高效的JavaScript搜索库,它的大小仅为1kb,却能提供强大的文本搜索功能。在Web开发中,特别是在数据量较大、实时性要求高的应用场景下,一个快速且轻量级的搜索解决方案至关重要。Wade的出现正是...
JavaScript.Editor.Pro应能方便地管理多个文件和目录,支持快速打开、关闭、搜索和重构代码。同时,与Git或其他版本控制系统集成,使得团队协作变得更加顺畅,可以轻松地提交、回滚和合并代码更改。 另外,性能分析...
在IT行业中,开发JavaScript应用程序时,一款好的集成开发环境(IDE)是必不可少的。Eclipse作为一款广泛应用的开源IDE,其强大的可扩展性使得开发者能够通过安装各种插件来增强其功能,特别是在JavaScript开发领域...
在项目`fuzzy-master`中,我们可以期待找到一个实现了上述模糊搜索概念的JavaScript库,它可能包含了源码、示例和文档,帮助开发者快速集成和定制模糊搜索功能。通过阅读源码和文档,我们可以学习到如何构建自己的...
"javascript源码大全CHM格式(精华)"是一部关于JavaScript编程的参考资料,以CHM(Microsoft Compiled HTML Help)格式提供,这种格式可以将HTML文档、图像和其他资源编译成一个可搜索的离线帮助系统。CHM文件以其...
本项目为基于Mybatis Plus的newbee-mall商城前端JavaScript版本源码,综合运用...项目特色在于集成了优惠券领取和支付宝沙箱支付功能,后台管理支持搜索操作,旨在为用户提供便捷的购物体验和高效的管理工具。
在本项目实践中,我们将探索如何在阿里云盘的Web端集成一个人工智能驱动的资源搜索引擎。这个搜索引擎将利用先进的自然语言处理技术,帮助用户快速、准确地查找存储在云端的各种资源,极大地提升用户体验。 首先,...
- **持续集成与部署**:采用持续集成(CI)和持续部署(CD)流程自动化测试和部署过程,提高开发效率和软件质量。 #### 三、案例分析 - **示例1:闭包的应用** 在实际项目中,可以通过闭包实现私有变量和方法,保护...
- 常见算法实现(排序、搜索等)。 - 错误处理与调试技巧。 - 模块化开发思想与工具(如CommonJS和ES Modules)。 4. **JavaScript小技巧全集** - **核心知识点**: - 字符串操作技巧(如拼接、截取等)。 - ...
这份“JavaScript资料大集成”包含了丰富的资源,旨在为初学者提供全面的学习路径,同时也适合有一定经验的开发者进行复习和提升。 首先,关于“实用教程”,这里可能包括了三本详细的教学书籍。它们可能涵盖了...