"Inter-row style fetch"
<div id= ' div1 ' style= ' backgroud:red ' > Test </div>
<script>
var Odiv=document.getelementbyid (' Div1 '); First get the element label to get the style, that is, get to Div1
Console.log (odiv.style.background); So we can get to the style of the rows
</script>
"Inline style fetch"
<script>
var odiv=document.getelementbyid (' Div1 '); Gets the element label to get the style, that is, get to Div1
//console.log (getComputedStyle (odiv,null). background); getComputedStyle ("element", "pseudo class") is obtained after the calculated style, the second argument is pseudo class, if not directly using null but the evil IE8 and not supported so need to use the following method
//console.log ( Currentstyle.background) This only IE itself support is also acquired to the computed style
console (Window.getcomputedstyle?getcomputedstyle odiv , null). Background:odiv.currentStyle); Cross-browser compatibility
</script>
</body>
"Outer chain style fetch"
"Outer chain style sheet"
. div2{
background:red;
}
The above JavaScript to get CSS line style, inline style and outside the chain style of the simple method is small to share the whole content of everyone, hope to give you a reference, also hope that we support cloud habitat community.