仿HAO123多搜索引擎跳转代码 本窗口

chenyajun  2020-01-29 15:28:42  阅读 2665 次 评论 0 条
<title>搜索引擎跳转代码 本窗口</title>
<form id="form1" name="form1" method="post" action="?">
  <label>
  <input name="k" type="text" id="k" value="" />
  </label>
  <label>
  <select name="seachid" id="seachid">
    <option value="1">百度</option>
    <option value="2">谷歌</option>
    <option value="3">搜狗</option>
    <option value="4">搜搜</option>
  </select>
</label>
  <label>
  <input type="button" name="button" id="button" value="给老子搜" onclick="subs();" />
  </label>
</form>
<script>
function encode(txts)
{
		mytxts=txts.replace(/[^\u0000-\u00FF]/g,function($0){return escape($0).replace(/(%u)(\w{4})/gi,"&#x$2;")});
		return mytxts;
}
//alert(rdurl);
function subs()
{
        var myid=document.getElementById("seachid").options[document.getElementById("seachid").selectedIndex].value;
		var txts=document.form1.k.value;
		var mytxts,urls,rdurl;
		switch(myid)
		{
		case "1":
		urls="http://www.baidu.com/baidu?&tn=kering&word="+encode(txts);
		break
		case "2":
		urls="http://www.google.com.hk/search?client=aff-cs-360se&forid=1&ie=utf-8&oe=UTF-8&q="+encode(txts);
		break
		case "3":
		urls="http://www.gougou.com/search?search="+txts;
		break
		case "4":
		urls="http://www.soso.com/q?w=s"+encode(txts);
		break
}
		//alert(urls);
<!--window.location.href=urls;-->
window.location.href=urls;
}
</script>


本文地址:http://www.chenyajun.net/index.php/post/32.html
版权声明:本文为原创文章,版权归 chenyajun 所有,欢迎分享本文,转载请保留出处!

评论已关闭!