CSS换肤
(我想可以换肤的网站,原理应该是这样吧)
<html>
<head>
<script language="javascript">
var url = document.location.toString();
var style = url.substr(url.length-1, 1);
switch (style)
{
case "1":
document.write('<style>@import "css1.css";</style>');
break;
case "2":
document.write('<style>@import "css2.css";</style>');
break;
default:
document.write('<style>@import "css0.css";</style>');
}
</script>
</head>
<body>
<div width="100%">这里是文字</div>
<input type="button" value="css1" onClick="document.location='http://127.0.0.1/test.htm?css=1'">
<input type="button" value="css2" onClick="document.location='http://127.0.0.1/test.htm?css=2'">
<input type="button" value="default" onClick="document.location='http://127.0.0.1/test.htm'">
</body>
</html>
(我想可以换肤的网站,原理应该是这样吧)
<html>
<head>
<script language="javascript">
var url = document.location.toString();
var style = url.substr(url.length-1, 1);
switch (style)
{
case "1":
document.write('<style>@import "css1.css";</style>');
break;
case "2":
document.write('<style>@import "css2.css";</style>');
break;
default:
document.write('<style>@import "css0.css";</style>');
}
</script>
</head>
<body>
<div width="100%">这里是文字</div>
<input type="button" value="css1" onClick="document.location='http://127.0.0.1/test.htm?css=1'">
<input type="button" value="css2" onClick="document.location='http://127.0.0.1/test.htm?css=2'">
<input type="button" value="default" onClick="document.location='http://127.0.0.1/test.htm'">
</body>
</html>
浙公网安备 33010602011771号