jsPro1/js動態修改整個html頁面樣式(換膚).html 
復制代碼 代碼如下:
 
<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
<title>動態修改頁面樣式</title> 
<link href="css/blue.css"/> 
<script type="text/javascript"> 
function gel(id) { 
return document.getElementById(id); 
} 
window.onload = function() { 
//更換css文件 
var lis = gel("uList").childNodes; 
for (var i = 0; i < lis.length; i++) { 
if (lis[i].nodeType == 1) { 
lis[i].onclick = function () { 
gel("mylink").href = "css/" + this.className + ".css"; 
}; 
} 
} 
}; 
</script> 
</head> 
<body> 
<div> 
<span>修改整個頁面的樣式</span><br/> 
<input type="text"/> 
<input type="button" value="提交"/> 
</div> 
<ul> 
<li></li> 
<li></li> 
</ul> 
</body> 
</html> 
復制代碼 代碼如下:
 
* { 
margin: 0px;padding: 0px; 
} 
body { 
background-color: #eeeeee; 
} 
span { 
color: red; 
} 
#txt { 
color: #f00;border: 1px solid #7d1515; 
} 
.btn { 
background-color: #a52a2a;border: none;color: white;width: 100px;height: 28px; 
} 
復制代碼 代碼如下:
 
* { 
margin: 0px;padding: 0px; 
} 
body { 
background-color: #eeeeee; 
} 
span { 
color: blue; 
} 
#txt { 
color: #0000cd;border: 1px solid #006400; 
} 
.btn { 
background-color: #0000cd;border: none;color: white;width: 100px;height: 28px; 
} 
新聞熱點
疑難解答
圖片精選