关键词: onclick     backgroundColor

<html>
<meta  charset="utf-8">
<title></title>
<body>
<div style="width:300px;height:300;background:red;"
 onclick="bianse(this)">点击</div>
</body>
<script>
function bianse(obj){
obj.style.backgroundColor='green'
}
 
</script>

</html>

js中改变颜色 onclick backgroundColor

 

 

相关文章:

  • 2021-12-19
  • 2021-12-19
  • 2022-12-23
  • 2021-11-05
  • 2021-12-15
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
相关资源
相似解决方案