function css(target,styles){

  for (var k in styles){

  target.style[k]=styles[k];

  }

}

示例:

var div = document.querySelector("div");

css(div,{width:300+"px",height: 400+"px",backgroundColor:green});

相关文章:

  • 2022-12-23
  • 2022-01-15
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2022-02-22
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案