换肤

 

//var _path = "/TabDemo/"; //如果网站不在根目录下 而是在虚拟目录下 请在这里写下虚拟目录的名称。
var _skinId = getCookie("_skinId") ? getCookie("_skinId"):"1";

function loadSkin(skinId)
{
    writeCookie("_skinId",skinId);
    top.window.location.reload();
}

//function $(id)
//{
//    return document.getElementById(id);
//}

function loadCss(skinId,cssName)
{
    var head = document.getElementsByTagName('head').item(0);
    css = document.createElement('link');
    css.href = "Skin/Skin" + skinId + "/"+cssName;   //Skin/Skin1/Main.css
    css.rel = 'stylesheet';
    css.type = 'text/css';
    css.id = 'loadCss';
    head.appendChild(css);
}

//function loadJs(file)
//{
//    var scriptTag = document.getElementById('loadScript');
//    var head = document.getElementsByTagName('head').item(0);
//    if(scriptTag) head.removeChild(scriptTag);
//    script = document.createElement('script');
//    script.src = "../js/mi_"+file+".js";
//    script.type = 'text/javascript';
//    script.id = 'loadScript';
//    head.appendChild(script);
//}

function setCookie(sKey, sValue, sDomain, sPath, sExpires, blSecure)
{
 var sCookieStr = sKey + "=" + sValue + ";";

 if (sDomain) sCookieStr += " DOMAIN=" + sDomain + ";";
 if (sPath)  sCookieStr += " PATH=" + sPath + ";";
 if (sExpires) sCookieStr += " EXPIRES=" + sExpires + ";";
 if (blSecure) sCookieStr += " SECURE";
 
 document.cookie = sCookieStr;
}

function writeCookie(key,value)
{
    var sExpires=new Date();
    sExpires.setTime(sExpires.getTime()+24*60*60*1000*365);
    setCookie(key,value,"","",sExpires.toGMTString(),"");
    if(getCookie(key) == null)
    {
        alert("您的浏览器安全设置过高,不支持Cookie,请重新设置浏览器的。");
    }
}
 
function getCookie(sKey)
{
 var sCookie = document.cookie;
 if( !sCookie ) return null;
 
 var sTag = sKey + "=";
  
 var iBegin = sCookie.indexOf(sTag);
 if (iBegin < 0) return null;
 
 iBegin += sTag.length;
 
 var iEnd = sCookie.indexOf(";", iBegin);
 if (iEnd < 0) iEnd = sCookie.length;
 
 return sCookie.substring(iBegin, iEnd);
}

//function delCookie(sKey)
//{
// var tNow = new Date();
// setCookie(sKey, "", null, null, tNow.toGMTString(), null);
//}

//function fullOpen(url)
//{
//    HeightValue=screen.height;
//    WidthValue=screen.width;
//    newwin=window.open(url,"","toolbar=0,location=0,directories=0,status=1,menubar=0,resizable=1,left=0,top=0,scrollbars=yes")
//    if(newwin == null)
//    {
//        alert("系统提示: 您的浏览器阻止了一个弹出窗口");
//        return;
//    }
//    newwin.moveTo(-3,-3);
//    newwin.resizeTo(WidthValue+6,HeightValue-23);
//}

//function ShowDiv(id)
//{
//    $(id).style.visibility = "visible";
//}
//function HiddenDiv(id)
//{
//    $(id).style.visibility = "hidden";
//}

 

 

 


<script type="text/javascript" src="Js/Main.js"></script>

    <script language="javascript" type="text/javascript">
       loadCss(_skinId,'Main.css');
    </script>
<a href="#" οnclick="loadSkin('1')" >黄</a>
       <a href="#" οnclick="loadSkin('2')" >红</a>

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值