码迷,mamicode.com
首页 > 其他好文 > 详细

如果attr=‘background’,style[attr]和style.attr的区别是:

时间:2015-04-27 12:38:21      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:

如果attr=‘background’,style[attr]和style.attr的区别是:

前者等价于style[‘background‘]或style.background,
后者等价于style.attr,
对于函数传参一类,不能使用后者。
 
另外需要注意的是,比如 a.style.height = "100px"; 等号右边需要是字符串,因此需要加上引号。

如果attr=‘background’,style[attr]和style.attr的区别是:

标签:

原文地址:http://www.cnblogs.com/bestend/p/4459538.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!