JavaScript换肤程序

JS实现换肤的效果:

需要2个css

pifu1.css:

body {background:#ccc; }
input {background:#12f; width:100px; height:100px; }


pifu2.css:

body {background:#acd; }
input {background:#fe2; width:200px; height:100px; }

html代码:

<!DOCTYPE HTML>
<html>
<!--此代码为页面更换皮肤的代码
包含程序:pifu1.css \  pifu2.css-->
<head>
<meta charset="utf-8">
<link id = "ui" rel="stylesheet" type="text/css" href="pifu1.css"  />
<script language="JavaScript">
function qiehuan()
{
    var vy = document.getElementById('ui');
    vy.href = "pifu1.css";
}
function qiehuan_2()
{
    var vy = document.getElementById('ui');
    vy.href = "pifu2.css";
}
</script>
</head>
<body>
<input  type="button" value="pi_fu_1 "     />
<input  type="button" value="pi_fu_2 "   />
</body>
</html>

皮肤1:

222905341.png

皮肤2:

222921713.png


你可能感兴趣的:(html,js,换肤)