<div id="divMain" title="aa" style="color:red;">
<div id="s">aaaaaaq</div></div>
<script>/*function copyElement(o)
{
var newObject = document.createElement("div");
newObject.innerHTML=o.innerHTML; for( i=0;i<o.attributes.length;i++)
{
//alert();
newObject.setAttribute([o.attributes[i].nodeName],o.attributes[i].nodeValue);
document.write(o.attributes[i].nodeName+":"+o.attributes[i].nodeValue+"<br>");
}
document.body.appendChild(newObject);

}
copyElement(document.getElementById("divMain"));
*/
document.write(document.getElementById("divMain").attributes["style"].nodeValue);//为什么输出 null ?
</script>