在js里加入事件 点击 移动等

var aa = document.getElementById('aa')
  var bb = document.querySelector('#bb')
  var cc = document.getElementById('cc')
  //给aa挂上事件 onclick
  aa.onclick = function(){
  cc.style.width = '300px'
  cc.style.height = '300px'
  cc.style.backgroundColor = 'red'
  }
  bb.onclick = function(){
  cc.style.width = '200px'
  cc.style.height = '200px'
  cc.style.backgroundColor = 'blue'
  }
posted @ 2022-03-18 23:49  猫java猫  阅读(95)  评论(0)    收藏  举报