javascript切换页面样式
2008-08-25 19:59:33 来源:WEB开发网核心提示:<html> <head> <title></title> <meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<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 type="button">切换背景颜色</button>
</body>
</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 type="button">切换背景颜色</button>
</body>
</html>
Tags:javascript 切换 页面
编辑录入:爽爽 [复制链接] [打 印]更多精彩
赞助商链接