日期:2014-05-16 浏览次数:20344 次
<script>
var comm = {
$: function (Id) { return document.getElementById(Id); },
GetCookie: function (name) { var m = new RegExp(name + '=([^;]+)', 'i').exec(document.cookie); if (m) return unescape(m[1]); return ""; },
SetCookie: function (name, value, cfgTime) { var d; if ("undefined" != typeof (icfgTime)) { d = new Date(); if (cfgTime.y) d.setFullYear(d.getFullYear() + cfgTime.y); if (cfgTime.M) d.setMonth(d.getMonth() + cfgTime.M); if (cfgTime.d) d.setDate(d.getDate() + cfgTime.d); if (cfgTime.h) d.setHours(d.getHours() + cfgTime.h); if (cfgTime.m) d.setMinutes(d.getMinutes() + cfgTime.m); if (cfgTime.s) d.setSeconds(d.getSeconds() + cfgTime.s); } document.cookie = name + "=" + value + ";path=/;" + (d ? "expires=" + d.toGMTString() : ''); },
shiftSkin: function (skin) {
var css = comm.$('skin_styles');
if (!css) {
css = document.createElement('link');
css.type = "text/css";
css.rel = "stylesheet";
css.id = 'skin_styles';
document.getElementsByTagName('head')[0].appendChild(css);
}
css.href = skin + '.css'; //注意修改你的路径
comm.SetCookie('cssskin', skin, { y: 1 });
}
};
window.onload = function () {
var skin = comm.GetCookie('cssskin'); alert(skin)
if (skin == "") skin = "blue";
comm.shiftSkin(skin);
}
</script>
<ul&