当前位置: 首页 > news >正文

凡客诚品公司介绍优化网站推广教程排名

凡客诚品公司介绍,优化网站推广教程排名,网站顶部地图代码怎么做,怎么自己开发网址讲评 节点属性 nodeType 元素节点 1 大写 属性节点 2 文本节点 3 #text 注释节点 8 #comment document 9 DocumentFragment 11 nodeName是只读属性元素节点的nodeName是大写的其余的是#小写的元素节点没有nodeValue属性#xff0c;null#xff0c;是可写的其余有#xff08…讲评 节点属性 nodeType 元素节点 1 大写 属性节点 2 文本节点 3 #text 注释节点 8 #comment document 9 DocumentFragment 11 nodeName是只读属性元素节点的nodeName是大写的其余的是#小写的元素节点没有nodeValue属性null是可写的其余有属性、注释、文本…getAttributeNode获取属性节点属性节点有nodeValue、value属性nodeType只读 封装方法遍历子元素 常规 类数组 获取属性 nodeValue是可写的 bodydiv classtemp iddiv_id/divscriptvar div document.getElementsByTagName(div)[0]console.log(div.getAttributeNode(id).nodeValue) // 以下方法都可以console.log(div.getAttributeNode(id).value)console.log(div.getAttributeNode(id)) // 了解console.log(div.attributes) // 了解console.log(div.getAttribute(id) )/scripthasChildNodes 有换行就有文本节点 Document构造函数 Document.prototype上有响应获取元素的方法 但是document并不是直接继承于Document.prototypedocument HTMLDocument Document document.__proto__ HTMLDocument.prototype HTMLDocument.prototype.__proto__ Document.prototypeDOM结构 1.Document dom是操作html和xml的不能操作cssDocument还有一个分支是XMLDocument 2. CharacterData Text.prototype.__proto__ CharacterData.prototype // trueComment.prototype.__proto__ CharacterData.prototype // true 3. Element 有HTMLElement和XMLElement分支 4. Node var div document.getElementsByTagName(div)[0] console.log(Object.prototype.toString.call(div)) // [object HTMLDivElement]DOM操作深入 Document.prototypeElement.prototype独享getELementById–独享getElementsByName–共享getElementsByTagName、getElementsByClassName、querySelector、querySelectorAll有 通配符* - getElementsByTagName 获取元素 用getElementsByTagName更好的方法是利用HTMLDocument的原型上的body、head属性直接用document.body通过原型链来访问 特document.title获取的是title标签内的文本而不是获取title元素若要选择标签则使用getElementsByTagNameDocument.prototype的documentElement可以访问到html 用document实例访问不能直接用**原型访问否则报错 原型属性HTMLDocument.prototypebody、headDocument.prototypedocumentElementhtml 练习 在原型上编程 遍历任意一个父元素 找到他的子元素节点 有数字参数 返回某一个对应子元素 没有则返回子元素集合 !DOCTYPE html html langenheadmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/title /headbodymaindivulli1/lili2/lili3/li/ulspan/span/div!-- 注释 --span/spana href/ap/p/mainscriptElement.prototype.myFindChildren function (pTagName) {var pNode document.getElementsByTagName(pTagName)[0]var idx arguments[1]if (idx) {return findChildren(pNode)[idx]} else {return findChildren(pNode)}}function findChildren(pNode) {var arr pNode.childNodes,arrLen pNode.childNodes.length,children []for (var i 0; i arrLen; i) {var item arr[i]if (item.nodeType 1) {children.push(item)}}return children}console.log(document.body.myFindChildren(main))console.log(document.body.myFindChildren(div, 1))/script /body/html在原型上编程 找出一个元素的第n层父级元素 !DOCTYPE html html langenheadmeta charsetUTF-8meta http-equivX-UA-Compatible contentIEedgemeta nameviewport contentwidthdevice-width, initial-scale1.0titleDocument/title /headbodymaindivulli1/lili2/lili3/li/ulspan/span/div!-- 注释 --span/spana href/ap/p/mainscriptElement.prototype.myFindPNode function (pTagName) {var cNode document.getElementsByTagName(pTagName)[0]var num arguments[1] || 1for (var i num; i 0; i--) {cNode cNode.parentNode}return cNode}console.log(document.body.myFindPNode(li))console.log(document.body.myFindPNode(li, 4))/script /body/html
http://www.huolong8.cn/news/146927/

相关文章:

  • 网站建设需要精通什么知识汝阳建设局网站
  • jquery做网站浏览量徐州企业建站系统模板
  • 做样子的网站河源新闻最新消息
  • 做家务的男人们在哪个网站播出开发一个平台
  • 怎样提高网站打开速度慢做做同城网站好还是做垂直网站好
  • 哪个汽车网站好泸县城乡住房建设厅网站
  • 关于成立网站建设项目小组的通知黄岩网站制作
  • 网站项目团队介绍深圳企业电话黄页
  • 个人 备案 多个网站吗做任务赚佣金的平台
  • 怎么用esc服务器做网站手机网站打不开是什么原因造成的
  • 哪个网站做系统好江苏推广网站建设业务
  • 濮阳网站建设哪家好wordpress如何加视频
  • 网站找人做备案的价格注册建设通网站
  • 建设安全协会网站如何用wordpress建一个网站
  • 网站域名被黑wordpress isset
  • 仿京东网站后台企业建设网站目的是什么意思
  • 学校网站管理wordpress获取指定图片大小
  • 关于服装的商务网站建设策划书做二手网站
  • 建站之星怎么安装google seo优化
  • wordpress 内部链接网站建设优化工资高不
  • 深圳网站建设艺之都企业注册网上申请入口
  • 广州微网站建设市场外贸营销型网站制作
  • 教育网站网址产品设计考研学校
  • 如何在人力资源网站做合同续签wordpress 改为中文
  • 百度站长平台官网登录入口桂林漓江风景图片
  • 免费个人建站空间wordpress消除
  • 番禺电商网站建设平面图设计软件app
  • 做追星网站效果图好看的网站页面设计
  • 个人备案做视频网站3d效果图制作公司
  • 易乐自助建站东莞外贸公司建网站