<script type="text/javascript"> alert(document.getElementById("test_div").style.border); </script>
safari和chrome上运行alert出来结果为空,IE、FF、Opera都有值。
演示: http://kindsoft.net/test/style_border_test.html
奇怪的是style.borderTop可以取得border,但style.borderLeft,style.borderBottom,style.borderRight都不行。
浏览器版本:
Windows XP, safari 3.2
Windows XP, chrome 1.0.154.36
问题补充:
应该是safari和chrome的BUG,style.border是W3C标准。
http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-ElementCSSInlineStyle
问题补充:
这个是Webkit的BUG,已经修复好了,只不过Safari和Chrome还没用最新版本Webkit,所以问题还在。
https://bugs.webkit.org/show_bug.cgi?id=15823