하위 노드 replaceChild 바꾸기()

5218 단어
DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>     replaceChild()title>
    
head>
<body>
    <div>      div>
    <script>
        var div=document.getElementsByTagName("div")[0];//     
        var newdiv=document.createElement("div");//       
        newdiv.innerHTML="    ,      div";//          
        document.body.replaceChild(newdiv,div);//  
    script>
body>
html>

좋은 웹페이지 즐겨찾기