英文渣尝试翻译Javascript.info,首篇选择了自认为难度不大的浏览器事件,然后我就遇到了下面这句话:
Please, note the two details:
- It is a property, not an attribute. The name of the property is
onevent
, case-sensitive and must belowercased.onClick
won’t work.- The handler must be a function, not a string.
原文:http://javascript.info/tutorial/introduction-browser-events
之前一直没注意过property和attribute的区别,傻傻的把它们统一归为中文“属性”。回想起《Javascript高级程序设计》中有一个曾让我莫名其妙的“特性”(见书P348)。查了一些相关资料,感觉大概整明白了一点。
网上有很多娓娓道来剖析原理的解释,个人提炼了一下,关于attribute和property的区别大概主要这么几点:
原文:http://www.cnblogs.com/butcherv/p/5186416.html