这个是没有种cookie的,记录给自已。
程序代码
<link href="001.css" id="cssfile" rel="stylesheet" type="text/css" />
<script>
function changeStyle(name){
//alert(name);
var css = document.getElementById("cssfile");
css.href = name+".css";
}
</script>
程序代码
<select onchange="changeStyle(this.options[this.selectedIndex].value)">
<option value="001" selected="selected">默认样式</option>
<option value="blue">蓝色经典</option>
<option value="red">红色梦幻</option>
</select>
<div id="cssTest">
我是一只小小小小小鸟!
</div>
看一下效果:
点击下面的运行,可预览代码效果:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>css test</title>
<link href="http://www.zishu.cn/attachments/css/001.css" id="cssfile" rel="stylesheet" type="text/css" />
<script>
function changeStyle(name){
//alert(name);
var css = document.getElementById("cssfile");
css.href = "http://www.zishu.cn/attachments/css/"+name+".css";
}
</script>
</head>
<body>
<select onchange="changeStyle(this.options[this.selectedIndex].value)">
<option value="001" selected="selected">默认样式</option>
<option value="blue">蓝色经典</option>
<option value="red">红色梦幻</option>
</select>
<div id="cssTest">
我是一只小小小小小鸟!
</div>
</body>
</html>