<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<link href="stylesheet1.css" type="text/css" rel="stylesheet" id="mycss">
<script language="javascript">
var turnback=false;
function setCSS()
{
mycss.styleSheet.cssText="";
mycss.styleSheet.addImport(turnback?"stylesheet1.css":"stylesheet2.css");
turnback=!turnback;
}
</script>
</head>
<body>
StyleSheet1.CSS样式代码:
BODY
{
background-color: Black;
}
StyleSheet2.CSS样式代码:
BODY
{
background-color: maroon;
}
<button onclick="setCSS()" type="button">切换背景颜色</button>
</body>
</html>