替换节点内文本的万用函数

function replaceNodeText(id,newText){

  var node = document.getElementById(id);

  while(node.firstChild)

      node.removeChild(node.firstChild);

  node.appendChild(document.creatTextNode(newText));

}

原文地址:https://www.cnblogs.com/f2e520/p/4912586.html