首页 > 代码库 > JS-获取任意html节点属性

JS-获取任意html节点属性

<script type="text/javascript" language="javascript">//

"); NewDivNode.append("" + tagName + "的属性:
"); var str = "node"; var myIndex = 1; for (var j in node) { try { var curStr1 = "错误"; var curStr2 = "错误"; try { curStr1 = typeof (eval(str + "." + j)); curStr2 = eval(str + "." + j); } catch (e) { } NewDivNode.append("" + myIndex + "、(" + curStr1 + "" + j + "" + ":"); NewDivNode.append("" + curStr2 + "" + "
"); } catch (e) { } myIndex++; } //$("body").html(NewDivNode); var newWin = window.open(‘‘, "_blank", ‘‘); newWin.document.open(‘text/html‘, ‘replace‘); newWin.document.write(NewDivNode[0].innerHTML); //向新打开的窗口中写数据 newWin.document.close(); //不关闭没有本质的影响,但浏览器会一直显示加载的样式 } else { alert("请检查HTML代码是否正确!"); $("#txtContent").select(); } } // ]]></script>

获取节点属性:
 
  
确定获取

 

JS-获取任意html节点属性