这样获取页面中控件的属性?
在FIREFOX中, 可以直接通过ctrobj.attributes获取到用户设置的属性; 但在IE中它却把控件继承到的所有属性都取出来了, 刚开始我写了一个正则表达式去匹配outerHTML, 临时解决了问题. 但反过来觉得这不是好的方式, 决定还是从attributes入手, 写了下面这样一个方法:
function getCtrlAttributes(ctrobj){var props = new Array();for(var i=0; i<ctrobj.attributes.length; i++){if(ctrobj.attributes[i].nodeValue != null && thisobj.attributes[i].nodeValue != "" )//contentEditable的值是inheritif(thisobj.attributes[i] != thisobj.attributes["contentEditable"])props.push(thisobj.attributes[i].nodeName);}return props;}