DOM操作自定义标签

创建标签然后对标签操作

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        abc{
            width: 20px;
            height: 20px;
            background-color: red;
            display: block;
        }
    </style>
</head>
<body>
<div id="box">
    <p id="child1">大壮</p>
</div>
<script type="text/javascript">
    var oDiv = document.getElementById('box');
    // var oP = document.createElement('abc');
    // oDiv.appendChild(oP);
    var op1 = document.getElementById('child1');
    var op2 = document.createElement('p');
    op2.innerText = '热狗';
    oDiv.insertBefore(op2, op1);

</script>
</body>
</html>

  

 

上一篇:股票跨度和逆波兰表达式


下一篇:net 与或非