CSS切换皮肤切换代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=gb2312" />
<meta name="generator" content="" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="robots" content="index, follow" />
<meta name="googlebot" content="index, follow" />
<title> </title>
<link rel="stylesheet" type="text/css" href="code/changestyle/styles1.css" title="styles1" media="screen" />
<link rel="alternate stylesheet" type="text/css" href="code/changestyle/styles2.css" title="styles2" media="screen" />
<link rel="alternate stylesheet" type="text/css" href="code/changestyle/styles3.css" title="styles3" media="screen" />
<script type="text/javascript">
window.onload=function(){ var c = readCookie('style');
if (c) switchStylestyle(c);
};
function switchStylestyle(styleName)
{ aa=document.styleSheets;
for(i=0;i<aa.length;i++)
{
aa[i].disabled = true;
if (aa[i].title== styleName){aa[i].disabled = false;}
};
createCookie('style', styleName, 365);
}
function createCookie(name,value,days)
{
if (days)
{
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++)
{
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name)
{
createCookie(name,"",-1);
}
// /cookie functions
</script>
</head>
<body id="">
<div id="wrapper">
<ul>
<li><a href="javascript:void(0);" onclick="switchStylestyle('styles1')">styles1</a></li>
<li><a href="javascript:void(0);" onclick="switchStylestyle('styles2')">styles2</a></li>
<li><a href="javascript:void(0);" onclick="switchStylestyle('styles3')">styles3</a></li>
</ul
</div>
</body>
</html>
posted on 2009-04-20 03:22
幽幽 阅读(851)
评论(0) 编辑 收藏 引用 所属分类:
web开发