今天看到一个淘宝客网站采用的链接跳转形式很值得学习,我放出代码供大家参考:
首先在模版文件中需要调用淘宝客链接的地方调用一个html文件,该文件格式如下:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” >
<head>
<title>请稍候……</title>
<script type=”text/javascript” src=”loads.js”></script>
</head>
<body>
</body>
</html>
你也可以在这里放一个统计代码以便统计数据。
然后新建一个load.js,在js文件中插入如下代码:
/* 作者:胡小易
* 胡小易博客huxiaoyi.com
*/
function onloads(){
var url = location.search;
/**********************************************************************************************
*
* 修改方法:如果销售页有10个产品,那么依次安装顺序填充location.href=”淘宝客推广代码”;
*
**********************************************************************************************/
if(url==”?id=1″){
location.href=”";
}
if(url==”?id=2″){
location.href=”";
}
if(url==”?id=3″){
location.href=”";
}
if(url==”?id=4″){
location.href=”";
}
if(url==”?id=5″){
location.href=”";
}
if(url==”?id=6″){
location.href=”";
}
if(url==”?id=7″){
location.href=”";
}
if(url==”?id=8″){
location.href=”";
}
if(url==”?id=9″){
location.href=”";
}
}
//调用函数
onloads();
如何使用这两个文件呢?
在我们可以更改这个js文件使得他可以跳转到我们指定的链接地址,然后在需要调用的地方加上那个html文件的路径+?id=*,即可使用了
除非注明,胡小易博客文章均为原创,转载请以链接形式标明本文地址
本文地址:http://huxiaoyi.com/website/20120726.html
推荐阅读
因为工作的原因,我每天不仅要做seo,还要做一些推广。其实我觉得推广就用处而言,要比seo更加稳定。但seo也有其的魅力和好处了。下面我分享我做百度知道发现的html+js代码和php代码。 Html+js 的跳转代码: script >>>详细阅读
本文标题:分析某淘宝客网站的链接跳转形式
地址:http://www.lgo100.com/a/34/20120731/78870.html

网友点评
精彩导读
科技快报
品牌展示