Element.getStyle returns the style apllied to the element if present and null otherwise.
V1.5_rc5 (prototype V 1.4.0_rc3)
Element.getStyle(element, style);
<p id="myparagraph" style="text-align:right">This is just some random text.</p>
<p>
<a href="#" onclick="alert(Element.getStyle('myparagraph', 'text-align' )); return false;">
On which side is the above paragraph aligned?
</a>
</p>
creates:
This is just some random text.
On which side is the above paragraph aligned?
element):
<style type="text/css">
<!--
#myotherparagraph {
text-align:right;
}
-->
</style>
<p id="myotherparagraph">This is just some random text.</p>
<p>
<a href="#" onclick="alert(Element.getStyle('myotherparagraph', 'text-align' )); return false;">
On which side is the above paragraph aligned?
</a>
</p>
creates:
This is just some random text.
On which side is the above paragraph aligned?
east):
<style type="text/css">
<!--
.east {
text-align:right;
}
-->
</style>
<p id="thisisnotmyparagraph" class="east">This is just some random text.</p>
<p>
<a href="#" onclick="alert(Element.getStyle('thisisnotmyparagraph', 'text-align' )); return false;">
On which side is the above paragraph aligned?
</a>
</p>
creates:
This is just some random text.