---
title: "项目兼容IE10操作"
author: "soft_xiaohui"
date: "2013-11-27T20:18:31Z"
tags: []
categories: ["Web前端"]
slug: "ie10"
draft: false
lastmod: "2013-12-03T10:59:12Z"
id: 1982031
url: "https://soft-xiaohui.iteye.com/blog/1982031"
---

1.判断js客户端对象是‘元素“ 还是”文本“ 可以用nodeType 属性。

## nodeType

nodeType 属性可返回节点的类型。

最重要的节点类型是：

元素类型 节点类型 元素 1 属性 2 文本 3 注释 8 文档 9

 

[http://www.w3school.com.cn/htmldom/dom\_nodes\_info.asp](http://www.w3school.com.cn/htmldom/dom_nodes_info.asp)

 

 

2\.

IE10 

TR 元素获得子元素  trElement.childNodes  的到NodeList

除了包含表示单元格td的元素还包含text 元素

以前的版本就包含td 元素

 

 

3

 

 

&lt;input type="button" id="selector" class="button" value="选择" onclick="customAtt(this);" \_id="${user.id}" \_name="name" \_deptName="deptName" \_deptId="${user.deptId}" /&gt;

 

function customAtt(node) {

var aa = node.attributes;

for ( var i = 0; i &lt; aa.length; i++) {

var ae = aa\[i];

alert('a---&gt;' + aa\[i].name)

}

}

 

 

 

 

自定义属性：" \_deptName   通过 aa\[i].name 获得是小写  deptname

 

3.HTML5增加了必填属性"required"

如果元素 &lt;INPUT TYPE="text" required=0 /&gt;

 

只要元素增加required属性，则表示该属性必填，不会管required的值是0 ，还是1