Blogger Information
Blog 35
fans 0
comment 1
visits 42680
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
innerhtml和innertext的区别
魏先生的博客
Original
1106 people have browsed it

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <div id="box">
              <ul>
                  <li>1</li>
                  <li>2</li>
                  <li>3</li>
                  <li>4</li>
              </ul>
        </div>
        <script type="text/javascript">
            var i = document.getElementById('box');
            i.innerHTML = '<a href="">hehe</a>';//输出 呵呵
            i.innerText = '<a href="">hehe</a>';//输出<a href="">hehe</a>,原样输出
            console.log(i.innerHTML);
        </script>
    </body>
</html>

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post