js实现点击改变元素样式

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>js重温</title>
	</head>
		<p id="www">1111</p>
		<button type="button" onclick="replace3()">点击3</button><!--点击改变元素样式-->
	</body>
	<script>
		}
		 function replace3(){
		 	var www=document.getElementById("www");//查找元素
		 	www.style.color="red";//改变样式
		 }
	</script>
</html>

猜你喜欢

转载自blog.csdn.net/weixin_42630877/article/details/83090885