js更高文档的样式

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        
        <style type="text/css">
            .bgred{
                background: red;
            }
            .bgblue{
                background: skyblue;
            }
        </style>
    </head>
    <body>
        <h1>helloworld</h1>
        <script type="text/javascript">
            var h1 = document.querySelector('h1')
//            h1.style.borderBottom = '11px solid #eee'
            h1.className = 'bgred'
            
        </script>
    </body>
</html>
原文地址:https://www.cnblogs.com/wwthuanyu/p/10555245.html