<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
<style>
    .bg{
        background-color:blue;
    }
</style>
</head>
<body>
    <input type="button" value="按钮" id="btn">
    <div id="box" style="width: 100px;background-color: pink;">文本</div>
    
    <script>
function my$(id){return document.getElementById(id)};
        var btn = my$("btn");
        var box = my$("box");

box.style.width = "200px";
box.style.backgroundColor = "red";

btn.className = "bg";
    </script>

</body>
</html>