今天为了教学需要,写了一个可以选择搜索的搜索引擎代码,在这里公布出来,主要用到的是JS控制链接代码,并在新窗口中打开,大家可以根据这个添加更多的搜索引擎的链接
<script language=javascript>
var searchLink;
function searchStr1(){
searchLink='http://www.baidu.com/s?cl=3&wd='+document.inForm.str.value;
window.open(searchLink,"","");
}
function searchStr2(){
searchLink='http://www.google.com/search?hl=zh-CN&lr=lang_zh-CN&q='+document.inForm.str.value;
window.open(searchLink,"","");
}
function searchStr3(){
searchLink='http://translate.google.cn/#zh-CN|en|'+document.inForm.str.value;
window.open(searchLink,"","");
}
function searchStr4(){
searchLink='http://translate.google.cn/#en|zh-CN|'+document.inForm.str.value;
window.open(searchLink,"","");
}
</SCRIPT>
<form name=inForm>
<input type=text name=str size=12 onmouseover='this.focus()' onfocus='this.select()'>
<input type=button value='百度' onClick='searchStr1()' style='background-color:#808080'>
<input type=button value='谷歌' onClick='searchStr2()' style='background-color:#808080'>
<input type=button value='汉译英' onClick='searchStr3()' style='background-color:#808080'>
<input type=button value='英译汉' onClick='searchStr4()' style='background-color:#808080'>
</form>
免费电话咨询
18955177249