标签:htm rip function lock cti es6 body 写法 document
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>demo</title> <style> * { padding: 0; margin: 0; } .head, li div { display: inline-block; width: 70px; text-align: center; } li .id, li .sex, .id, .sex { width: 15px; } li .name, .name { width: 40px; } li .tel, .tel { width: 90px; } li .del, .del { width: 15px; } ul { list-style: none; } .user-delete { cursor: pointer; } </style> </head> <body> <div id="J_container"> <div class="record-head"> <div class="head id">序号</div><div class="head name">姓名</div><div class="head sex">性别</div><div class="head tel">电话号码</div><div class="head province">省份</div><div class="head">操作</div> </div> <ul id="J_List"> <li><div class="id">1</div><div class="name">张三</div><div class="sex">男</div><div class="tel">13788888888</div><div class="province">浙江</div><div class="user-delete">删除</div></li> <li><div class="id">2</div><div class="name">李四</div><div class="sex">女</div><div class="tel">13788887777</div><div class="province">四川</div><div class="user-delete">删除</div></li> <li><div class="id">3</div><div class="name">王二</div><div class="sex">男</div><div class="tel">13788889999</div><div class="province">广东</div><div class="user-delete">删除</div></li> </ul> </div> <script> // 此处也可换成ES6的写法 function Contact(){ this.init(); } var wfd = document.getElementsByClassName("user-delete") for(var i=0;i<wfd.length;i++){ wfd[i].onclick = function(){ this.parentNode.remove(); } } // your code here </script> </body> </html>
标签:htm rip function lock cti es6 body 写法 document
原文地址:http://www.cnblogs.com/jiaxiaonuo/p/7208033.html