欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          怎么使用javascript改變顏色

          使用javascript改變顏色的方法:1、使用“元素對象.style.color = "顏色值";”語句來改變文本顏色;2、使用“元素對象.style.backgroundColor = "顏色值";”語句來改變背景顏色。

          怎么使用javascript改變顏色

          本教程操作環(huán)境:windows7系統(tǒng)、javascript1.8.5版、Dell G3電腦。

          使用javascript改變顏色

          1、使用Style對象color 屬性改變文本顏色

          color 屬性可設(shè)置文本的顏色。

          <!DOCTYPE html> <html> 	<head> 		<meta charset="utf-8"> 	</head> 	<body> 		<div id="box">元素內(nèi)容</div><br /> 		<button onclick="myFunction()">改變文本顏色</button> 		<script> 			function myFunction() { 				var box = document.getElementById("box"); 				box.style.color = "red"; 			} 		</script> 	</body>  </html>

          怎么使用javascript改變顏色

          2、使用Style對象backgroundColor 屬性改變背景顏色

          backgroundColor 屬性可設(shè)置元素的背景顏色。

          <!DOCTYPE html> <html> 	<head> 		<meta charset="utf-8"> 	</head> 	<body> 		<div id="box">元素內(nèi)容</div><br /> 		<button onclick="myFunction()">改變背景顏色</button> 		<script> 			function myFunction() { 				var box = document.getElementById("box"); 				box.style.backgroundColor = "red"; 			} 		</script> 	</body>  </html>

          怎么使用javascript改變顏色

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號