<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="box" >div 1</div>
    <script>
        var box = document.getElementById("box");
        console.dir(box);
        var idNode = box.getAttributeNode("id");
        //输出元素的id
        console.dir(idNode);
        //更改元素的id由box改为demo
        idNode.nodeValue = "demo";

        var childNodes = box.childNodes;

        console.log(childNodes);

        //将元素的nodeValue由DIV改为box 1

        childNodes[0].nodeValue = "box 1";

        
        


    </script>



</body>
</html>