style properties

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>样式</title>    
    <script type="text/javascript">
        var supportDOM2CSS=document.implementation.hasFeature("CSS","2.0");
        alert(supportDOM2CSS);
        var supportDOM2CSS2=document.implementation.hasFeature("CSS2", " 2.0 " ); 
        Alert (supportDOM2CSS2); 
/ * 
put here can not get the div element, because the browser is rendering the page from top to bottom, when faced with an embedded CSS and JS, DOM will stop building tree. Js can be loaded later on by body, it can also be used as follows event listeners. 
         document.getElementById myDiv = var ( "myDiv");             
         myDiv.style.fontSize = "by 150px";                 
         myDiv.style.backgroundColor = "Gold"; 
         Alert (myDiv); 
         Alert (myDiv.style.backgroundColor); 18 is 
* / 
    Document .onreadystatechange = function () {
     IF (the document.readyState == ' Complete '
         =document.getElementById("myDiv");            
         myDiv.style.fontSize="150px";                
         myDiv.style.backgroundColor="gold";
         alert(myDiv);
         alert(myDiv.style.backgroundColor);
        }
    }        
    </script>        
</head>
<body>
<div id="myDiv">一个Div标签</div>
</body>
</html>

The above problem is ignored in practice style property set style, follow-up should pay attention to.

Guess you like

Origin www.cnblogs.com/planetwithpig/p/11456086.html