学习总结--Dom
节点(每个元素都会有的3个nodeValue nodeType nodeName;)
1 元素节点 nodeName 元素节点名 nodeType 1 nodeValue null或者undefined
2属性节点 nodeName 属性节点名 nodeType 2 nodeValue 属性节点的值
3 文本节点 nodeName #text nodeType 3 nodeValue 文本值
2 创建元素节点 document.createElement('li')
3创建文本节点document.createTextNode("123");
4 属性节点 通过元素节点.属性名去创建或者 node.setAttribute(name,value);获取节点的属性值 node.getAttribute(name);移除节点的属性值 node.removeAttribute(name);
5追加节点 node.appendChild(newchild);
6 删除节点 node.parentNode.removeChild(node);
7 克隆节点 node.cloneNode(true);
8 替换节点node.replaceChild(nwchild, oldchild); 除了具有替换节点的功能,还具有移动节点的功能;可以自定义函数replaceEach(achild,bchild) 两个节点彼此替换位置;
9父节点 paraentNode 子节点 firstElementChild firstChild lastElementChild lastChild 下一兄弟节点nextSibling nextElementSibling 前一兄弟节点previousSibling previousElementSibling;
10节点的获取
document.getElementById('');
document.getElementsByTagName('');
document.getElementsByClassName('')
document.getElementsByName('');
最新文章
- C#+OpenGL+FreeType显示3D文字(2) - 用GLSL+VBO绘制文字
- 在VMware Workstation上安装CentOS6.5系统步
- Android HTTPS(5)SSL测试工具
- [原创] Ubuntu Linux 安装Eclipse
- callback调用测试
- JAVA学习路线图---(JAVA1234)
- jquery 事件委托绑定click的使用方法
- 使用Entity Framework时要注意的一些性能问题
- 常见HTTP状态码大全
- 黑马程序员——Java高级应用(一)
- 字符设备驱动4: ioremap
- Kubernetes运维生态-cAdvisor分析
- pytorch实现VAE
- 一步一步创建ASP.NET MVC5程序[Repository+Autofac+Automapper+SqlSugar](八)
- SpringCloud实战-Hystrix请求熔断与服务降级
- C. Nice Garland Codeforces Round #535 (Div. 3) 思维题
- 灯箱效果插件Magnific Popup详解
- UBUNTU 安装教程
- 廖雪峰Java3异常处理-2断言和日志-2使用JDK Logging
- powerDesigner 把name项添加到注释(comment)
热门文章
- jsp urlrewrite 中正則表達式不包括某个字符串写法
- leetCode解题报告5道题(七)
- Cannot find the class file for javax.servlet.ServletContext.
- css3模糊图片
- less03 混合
- sass04 嵌套、继承、占位符
- BZOJ2179: FFT快速傅立叶 &; caioj1450:【快速傅里叶变换】大整数乘法
- caffe(1) 网络结构层参数详解
- linux下python3源码安装及卸载
- luogu P3157 [CQOI2011]动态逆序对(CDQ分治)