js 改变样式

直接改变样式、改变className和改变cssText
  
  改变className: document.getElementById('obj').className="…"
  
  改变cssText:document.getElementById('obj').style.cssText="width:20px; border:solid 1px #f00;";
  
  改变直接样式: document.getElementById('obj').style.backgroundColor="#003366″
  

猜你喜欢

转载自pb-water.iteye.com/blog/2339457