contenteditable="true" 后的值的获取

2020-10-12 14:15:26  阅读 4939 次 评论 0 条
<!DOCTYPE HTML>
<html>
    <script>  

        function _submits()            
        {                
            var a=document.getElementById("cnt1").innerText;              
            alert(a);
            }         
        </script>
<body>

<h2> Shoppping List(Content Editable)可编辑 </h2>
 <ul class="content-editable" contenteditable="true" id="cnt1" style="border:solid 1px #000">
     <li> 1. Milk </li>
     <li> 2. Bread </li>
     <li> 3. Honey </li>
</ul>


<input type="button" onclick="_submits()" value="提交" />        

</body>
</html>
<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script type="text/javascript">

        function getElements(){
            var x=document.getElementsByName("div");  
          for(var i=0;i<x.length; i++){
            alert(x[i].innerHTML);
            }
        }    </script>
          </head>
          <body>
    <div id="1">1231</div>
    <div id="2">qweq</div>
    <div id="3">qw12</div>
    <div id="4">as12</div>
    <div id="5">zx12</div>
          </body>
          </html>


本文地址:http://jinesc.cn/?id=200
免责声明:本文为原创文章,版权归 jinesc 所有,欢迎分享本文,转载请保留出处!

发表评论


表情

还没有留言,还不快点抢沙发?