久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      javascript怎么刪除類名

      javascript刪除類名的方法:1、使用“document.getElementById("id值")”語句根據(jù)id值獲取指定元素對象;2、使用“元素對象.classList.remove("類名")”語句刪除指定的類名。

      javascript怎么刪除類名

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

      在javascript中,可以利用classList屬性和remove()方法來刪除類名

      classList 屬性返回元素的類名,作為 DOMTokenList 對象。該屬性用于在元素中添加,移除及切換 CSS 類。

      classList 屬性是只讀的,但你可以使用 add() 和 remove() 方法修改它。

      示例:刪除類名“mystyle”

      <!DOCTYPE html> <html> 	<head> 		<meta charset="utf-8">  		<style> 			.mystyle { 				width: 300px; 				height: 50px; 				background-color: coral; 				color: white; 				font-size: 25px; 			} 		</style> 	</head> 	<body>  		<p>點(diǎn)擊按鈕移除 DIV 元素中的 "mystyle" 類.</p> 		<button onclick="myFunction()">點(diǎn)我</button><br><br> 		<div id="myDIV" class="mystyle"> 			我是一個 DIV 元素。 		</div> 		<script> 			function myFunction() { 				var div=document.getElementById("myDIV"); 				div.classList.remove("mystyle"); 			} 		</script>  	</body> </html>

      javascript怎么刪除類名

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