1, Obj.style only get inline style (inline style) is written in the tag, he can not access those links to external CSS and in the head of the <style> declaration style.
So it must be recognized that in those pages that use an external CSS file, if you use style to assign a value, such as obj.style= "color:red"; Obviously the effect is correct, and the mystery is simply adding a style attribute to the object's tag. It is presented in the order of priority from small to large.
2, Obj.currentstyle is so much more powerful that he can get a style about all the positions of the node, but he also takes precedence, which means that what he is pointing to is what style he refers to, the following code font priority is blue, and that Currentstyle.color is blue. , of course, this time Style.color will also be blue.
Copy Code code as follows:
<meta http-equiv= "Content-type" content= "text/html; Charset=iso-8859-1 ">
<title>testStyle</title>
<style>
. lala{
Color:yellow;
}
</style>
<body>
<div id= "tt" style= "Color:blue;" class= "Lala" >1111</div>
</body>
<script>
Alert (document.getElementById ("tt"). Currentstyle.color);
</script>
If you remove the above <div> style for <div id= "tt" class= "Lala" >1111</DIV> Then Currentstyle.color becomes yellow according to priority, but Style.color is empty at this time.
3, Runtimestyle Simple is that you can assign a value to a node's style, he will become the highest priority node style.
Such as:
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD" >
<meta http-equiv= "Content-type" content= "text/html; Charset=iso-8859-1 ">
<style>
. lala{
Color:yellow;
}</style>
<body>
<div id= "tt" style= "Color:blue;" class= "Lala" >1111</div>
</body>
<script>
document.getElementById ("tt"). runtimestyle.color= "BLACK";
Alert (document.getElementById ("tt"). Currentstyle.color);
Alert (document.getElementById ("tt"). Runtimestyle.color);
Alert (document.getElementById ("tt"). Style.color);
</script>
At this point, the color of the page display word is runtimestyle. But only Currentstyle.color and runtimestyle themselves can get this value, and Style.color is still the blue in tag.