Access properties: Obj.attr or obj[' attr ']
Access the Style property via JS:
Style can only get inline styles for elements. Therefore, to get the complete style information for an element, you must use the getComputedStyle method of the Window object, which has 2 parameters, the first parameter is the element to get the calculated style, the second argument can be null, an empty string, a pseudo-class (for example: before,: After), both of these parameters are required.
Complete Example:
<! DOCTYPE HTML >
<HTML><Head> <style>#mask{position:Absolute;Z-index: +;Top:10px; Left:0;background:Blue;width:100px;Height:100px; } </style></Head><Body> <DivID= "Mask"style= "Border:dashed"></Div><Script> varMask=document.getElementById ('Mask'); varstyle=window.getComputedStyle (Mask,""); Console.log (' the', Style.position,mask.style.border);</Script></Body></HTML>
Native JavaScript get CSS style