Prototype - getStyle() 方法
此方法返回元素的给定 CSS 属性值。属性可以采用 CSS 或驼峰格式指定。
因此,提供 font-size 和 fontSize 是等效的。
语法
element.getStyle( property );
返回值
CSS 属性值,如果未找到属性集,则返回 NULL。Internet Explorer 返回文字值,而其他浏览器返回计算值。如果元素被隐藏,Safari 将为任何非内联属性返回 null。
示例
<html>
<head>
<title>Prototype examples</title>
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
<script>
function showResult() {
var str = $('grandfather').getStyle('margin-left');
alert("Element left margin is : " + str );
}
</script>
<style>
#grandfather {
font-size: 12px;
margin-left: 1em;
}
</style>
</head>
<body>
<p>单击按钮查看结果。</p>
<div id = "grandfather">This is grand father
<div id = "father"> This is father.
<div id = "kid">This is kid</div>
</div>
</div>
<br />
<input type = "button" value = "showResult" onclick = "showResult();"/>
</body>
</html>

prototype_element_object.html