回首页 ◎ 设为首页  
◎ 收藏本站  
◎ 联系我们  
  首 页  网络资讯  教程资料  免费资源  建站指南  休闲娱乐  经典整站  访客留言  
  当前位置:首 页 >> 教程资料 >> 网页制作 >> 带COOKIE功能的网站线路分析代码
最 新 推 荐
淘宝网店“设计装修”..推荐
网页制作常见105个问..推荐
使用FrontPage2000注..推荐
网页制作常用代码推荐
颜色代码大全推荐
热 门 排 行
北京奥运会倒计时代码
如何在网页中插入Flas..
网页自动点击广告代码
星空动态星空背景特效..
如何用Frontpage下载..
网页两侧浮动广告代码
离开时自动提示设为首页
颜色代码大全推荐
怎么使网页跳转地址栏..
站长常用广告代码的表..
淘宝网店“设计装修”..推荐
在网页上设计飘动广告
网页制作常用代码推荐
网页常用特效整理:高..
网页制作常见105个问..推荐
使用css设置iframe样式
最 近 更 新
CSS在表格边框上的美..
Flash文件中多个swf调..
圆角边框的代码
股票即时行情查询系统
万能音.视频在线转换..
仿3721窗口拖动的代码
美化的GOOGLE广告代码
修改discuz5.5,让广..
一些所谓的CSS的“顶..
中英文双语导航菜单
广 告 位 置
站 内 搜 索
关键词

搜索方式

搜索范围

精确匹配
带COOKIE功能的网站线路分析代码

来源:盛绿设计 等级:默认等级
发布于2006-11-12 01:59 被读20次 【字体:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>拜客网络 - 请选择最快的站点</title>
<script type="text/javascript">
var cookieEnabled=(navigator.cookieEnabled)? true : false
//判断cookie是否开启

//如果浏览器不是ie4+或ns6+
if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled){
document.cookie="testcookie"
cookieEnabled=(document.cookie=="testcookie")? true : false
document.cookie="" //erase dummy value
}

/*
检查此IE是否支持cookie

*/       
//document.cookie = 'killme' + escape('nothing')
function cc()
{
        if (document.cookie == "")
        {
                alert("请打开cookie选项");
                document.getElementById('message').style.display='';
                document.getElementById('setarea').style.display='none';
                window.setTimeout("goto();",3000) 
                document.Form1.cookieexists.value ="false"
        }
        else
        {
                Get();
        alert("你已经打开了cookie选项!!!!!");
        document.getElementById('setarea').style.display='';               
        }
}


function GetCookie(name)
{
     var arg=name+ "=";
     var alen=arg.length;
     var clen=document.cookie.length;
     var i=0;
     while (i<clen) {
       var j=i+alen;
       if(document.cookie.substring(i,j)
       ==arg)
       return getCookieVal(j);
       i=document.cookie.indexOf("",i)+1;
       if(i==0)break;
     }
     return null;
}

function getCookieVal(offset) {
     var endstr=document.cookie.indexOf
       (";",offset);
     if(endstr==-1) //没有指定其他元素
       endstr=document.cookie.length;
     return unescape(document.cookie.substring
       (offset,endstr));
   }

function Get()
{                       
        if (cookieEnabled)
        {               
                var CookieArea = GetCookie('zz_area');
                //var CookieArea = "CNC";
                if (CookieArea == "CNC")
                {               
                        document.getElementById('loading').style.display='';                               
                        document.getElementById('setarea').style.display='none';                               
                        this.location = "http://cnc.bkbbs.net/index.php";
                }
                else
                {
                        //判断电信线路
                        if (CookieArea == "TEL")
                        {
                                document.getElementById('loading').style.display='';                               
                                document.getElementById('setarea').style.display='none';                               
                                this.location = "http://bbs.bkbbs.net/index.php";
                        }
                        //判断移动线路
                        if (CookieArea == "YD")
                        {
                                document.getElementById('loading').style.display='';                               
                                document.getElementById('setarea').style.display='none';                               
                                this.location = "http://www.bkbbs.net/index.php";
                        }                               
                        else
                        {
                                document.getElementById('setarea').style.display='';
                        }
                }
        }
        else
        {               
                this.location = "http://www.bkbbs.net/index.php";
        }
}
function SetCNC()
{
        var mydate = new Date();
        mydate.setTime(mydate.getTime() + 315360000000);
        document.cookie = "zz_area=CNC;expires="+ mydate.toGMTString() + ";domain=bkbbs.net";
        Get();
}
function SetTEL()
{
        var mydate = new Date();
        mydate.setTime(mydate.getTime() + 315360000000);
        document.cookie = "zz_area=TEL;expires=" + mydate.toGMTString() + ";domain=bkbbs.net";
        Get();
}
function SetYD()
{
        var mydate = new Date();
        mydate.setTime(mydate.getTime() + 315360000000);
        document.cookie = "zz_area=YD;expires=" + mydate.toGMTString() + ";domain=bkbbs.net";
        Get();
}
</script>
<body onload="Get()">
<table width="100%" height="180" border="0" cellspacing="0">
          <tr>
                    <td align="center" valign="bottom"><img src="../image/logo.gif" width="180" height="60" /></td>
          </tr>

</table>
<table width="450" border="0" align="center" cellspacing="0" bgcolor="#FFFFFF">
          <tr>
                    <td height="1" bgcolor="#FF6600"></td>
                    <td width="200" bgcolor="#FFFFFF"></td>
                    <td height="1" bgcolor="#FF6600"></td>
          </tr>
</table>
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>

                    <td width="1" bgcolor="#FF6600"></td>
                    <td>
<div id="message"  align="center" style="display:none">
        由于你的浏览器没有开启COOKIE功能(建议打开),系统将在3秒钟后,自动引导到拜客网络主服务器...
</div>
<div id="loading" align="center" style="display:none">
<br />
        正在装载,请稍候...
</div>       
<div id="setarea"  align="center" style="display:none">
        <br />
        请您选择最快的站点,此选项将不会再次出现<br /> <br />

        如您希望重新选择,请清除浏览器COOKIE<br /><br />
          <br />
        <input type="button" value="中国移动" onClick="SetYD()">
        <input type="button" value="北方网通" onClick="SetCNC()">
        <input type="button" value="南方电信" onClick="SetTEL();">
        <input type="button" value="自动判断" onClick="javascript:window.location='auto.html'">
</div>

<br />
</td>
<td width="1" bgcolor="#FF6600"></td>
</tr>
</table>
<table width="450" height="1" border="0" align="center" cellspacing="0">
        <tr>
                  <td bgcolor="#FF6600"></td>
        </tr>
</table>
</body>
</html>
[/quote]
可以把这代码放在index.htm做主页
它也可以自动选择
自动选择页面代码
[quote]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>拜客网络..无限的精彩..这里有你想要的..</title>
<style type="text/css">
<!--
body {
    margin: 0;
    padding: 0;
    font-size: 14px;
    color: #333;
    text-align: center;
}
#wrap {
    margin:50px auto;
    background: #FFF;
}

#wrap p{
    margin:40px 0;
}

a:link {
    color: #63b900;
    text-decoration: none;
    border-bottom: 1px dashed;
}

a:visited {
    color: #7fc937;
    text-decoration: none;
    border-bottom: 1px dashed;
}

a:hover {
    color: #cc6600;
}

a:active {
    color: #4f711f;
}

-->
</style>
<script type="text/javascript" src="/js/title.js" charset="gb2312"></script>
</head>
<body>
<div id="wrap">
<p>尊敬的朋友,您好!自动选择最快的镜像服务器访问本站</p>

<p>速度测试中……</p>

<script type="text/javascript">
    i=1
    var autourl=new Array()
    autourl[1]="http://www.bkbbs.net/index.php"
    autourl[2]="http://bbs.bkbbs.net/index.php"
    autourl[3]="http://cnc.bkbbs.net/index.php"
       
    function auto(url){
    if(i){i=0;top.location=url}
    }
    function run(){
    for(var i=1;i<autourl.length;i++) 
     document.write("<img src='"+autourl[i]+"' width=1 height=1 onerror=auto('"+autourl[i]+"')>")
    }
    run()
</script>

<p>
版权所有:拜客网络 2002-2005 未经授权禁止复制或建立镜像<br>
Copyright TM 2000 - 2006 Bkbbs.net <br>
中华人民共和国电信与信息服务业务经营许可证编号 <a href="http://www.miibeian.gov.cn/" target="_blank">浙ICP备05020460号</a><br>
</p>
</div>
</body>
</html>


相关专题:暂无相关专题

上一篇:最新RSS 2.0规范(中文版)大全
下一篇:给网页文字加上即时提示

共有评论 0 条 网友评分 0分 查看全部

【发表评论】 评分:1分 2分 3分 4分 5分


Powered By Www.Xydw.COM Ver1.14 管理
Copyright © 2004-2005 盛绿设计 All Right Reserved. XCMS
冀ICP备06026128号