javascript dom 编程艺术 CSS DOM

126 阅读1分钟
p#example{
    color:red;
    font:12px 'Arial',sans-serif;
}
<!DOCTYPE html>
<head>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <title>Example</title>
    <link rel="stylesheet" href="styles/styles.css" type="text/css" media="screen"/>




   <script type="text/javascript">
    window.οnlοad=function(){
        var para=document.getElementById("example");
alert("The font size is "+para.style.fontSize);
para.style.color="black";
para.style.font="2em 'Times',serif"
    }
    </script>
<body>
    <p id="example">An example of a paragraph</p>
</body>
</head>
</html>