getAttributeNode("style").nodeValue 为什么得不到值,明白后立即结分
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <title></title></head><body> <div id="cc" style="color: Black; font-size: 34px;">klkjlkjlfs</div></body><script language="javascript" type="text/javascript">var i=document.getElementById("cc").getAttributeNode("style").nodeValue;alert(i);</script></html>
var i=document.getElementById("cc").getAttribute("style").cssText;
[解决办法]
var i=document.getElementById("cc").style.cssText;
[解决办法]