亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

JavaScript? CSS ???? ????.

??:
nodeObject.style.cssProperty
? ? nodeObject? ?? ???? cssProperty? CSS ?????.

?:

document.getElementById("demo").style.height;
document.getElementById("demo").style.border;

??: "-"? ??? CSS ??? ?? "-"? ???? "-" ?? ? ?? ??? ???? ?????. ?:
background-color? backgroundColor? ???? ???.
line-height? lineHeight? ???? ???.

?:

document.getElementById("demo").style. backgroundColor;
document.getElementById("demo").style.lineHeight;

?? ??, ???? ?????. id="demo"? ??:

<div id="demo" style="height:50px; width:250px; margin-top:10px; text-align:center; line-height:50px; background-color:#ccc;">
    點(diǎn)擊這里獲取CSS樣式
</div>
<script type="text/javascript">
    document.getElementById("demo").onclick=function(){
        alert(
            "高度:"+this.style.height+"\n"+
            "寬度:"+this.style.width+"\n"+
            "上邊距:"+this.style.marginTop+"\n"+
            "對(duì)齊:"+this.style.textAlign+"\n"+
            "行高:"+this.style.lineHeight+"\n"+
            "背景顏色:"+this.style.backgroundColor
        );
    }
</script>

? ??? ?? ???? HTML?? CSS ???? ?????.

<style>
#demo{
    height:50px;
    width:250px;
    margin-top:10px;
    text-align:center;
    line-height:50px;
    background-color:#ccc;
    }
</style>
<div id="demo">
    點(diǎn)擊這里獲取CSS樣式
</div>
<script type="text/javascript">
    document.getElementById("demo").onclick=function(){
        alert(
            "高度:"+this.style.height+"\n"+
            "寬度:"+this.style.width+"\n"+
            "上邊距:"+this.style.marginTop+"\n"+
            "對(duì)齊:"+this.style.textAlign+"\n"+
            "行高:"+this.style.lineHeight+"\n"+
            "背景顏色:"+this.style.backgroundColor
        );
    }
</script>

??? ??? CSS ???? ?? ? ????. HTML ??? CSS ???. ??
nodeObject.style.cssProperty
? DOM ??? style ??? ?? ??? ???? ?? ?????. style ??? ???? ??? style ??? ?? ???? ???? ????. ????? ?? ? ????.

?, JavaScript? ?? ???? ???? ?? <style> ??? CSS ??? ???? ?? ??? ??? ??? ???? ??? ? ????.

???? ??
||
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>無(wú)標(biāo)題文檔</title> <div id="demo" style="height:50px; width:250px; margin-top:10px; text-align:center; line-height:50px; background-color:#ccc;"> 點(diǎn)擊這里獲取CSS樣式 </div> <script type="text/javascript"> document.getElementById("demo").onclick=function(){ alert( "高度:"+this.style.height+"\n"+ "寬度:"+this.style.width+"\n"+ "上邊距:"+this.style.marginTop+"\n"+ "對(duì)齊:"+this.style.textAlign+"\n"+ "行高:"+this.style.lineHeight+"\n"+ "背景顏色:"+this.style.backgroundColor ); } </script> </head> <body> </body> </html>