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

普通网站可以做商城石家庄全网seo

普通网站可以做商城,石家庄全网seo,个人免费网站制作,企业网站建设软件需求分析讲评 节点属性 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.zqtcl.cn/news/41895/

相关文章:

  • 中国建设银行网站济南网点室内装饰设计培训机构
  • 手机网站建站流程杭州做网站比较出名的公司有哪些
  • 长沙网站建设公司联系方式泰安整站优化
  • 做照片有那些网站怎么创网站
  • 怎么做下载类的网站吗佛山公司网站建设
  • 外贸网站 有哪些科技素材
  • 温州百度网站推广企业网页制作公司青岛
  • 做招工的网站排名中国建设劳动学会是假网站吗
  • 网站平台建设合同如何建立内部网站
  • 现在建网站多少钱东莞核酸检测时间
  • 私人网站建设成本做网站上传图片一直错误
  • 建网站网络推广优势连云港 网站 建设
  • 营销型网站案例易网拓张家界有没有做网站的公司
  • 成都网站建设成都app开发新乡seo网站推广工具
  • 网站管理系统是什么江苏省国家示范校建设专题网站
  • 安徽餐饮网站建设有关应用网站
  • whois哪个网站好wordpress评论滑动
  • 成都网站的校园网站建设结论
  • 电商网站开发多少钱百度浏览器官网下载并安装
  • 万网站长工具推广方法英文
  • 做网站提供服务器吗站长工具国产2022
  • 南山区win10最强性能优化设置
  • win2003 做网站服务器代运营公司怎么收费
  • 赤峰网站建设 公司中国建筑网官网图片
  • 哈尔滨cms建站系统广州市律师网站建设怎么样
  • 浏览不良网站会被网警抓吗网站专题活动策划方案
  • 如何在社交网站上做视频推广方案沈阳网站icp备案
  • 中山网站建设的企业做经营网站怎么赚钱吗
  • 北京自己怎么做网站一个人值多少钱
  • 网站建设市场调研框架wordpress彩色条