為什么我通過createElement方法添加的空P元素不能通過firstChild.nodeValue改變文本內(nèi)容,而用html寫的空P元素可以??//動態(tài)添加空的p元素?? ? ? var addtext = document.createElement('p');? ? ? ? addtext.id = "description";? ? ? ? document.getElementsByTagName('body')[0].appendChild(addtext);//改變文本內(nèi)容? ? ? var description = document.getElementById('description');? ? ? var text = whichpic.getAttribute('title');? ? ? description.firstChild.nodeValue=text;