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

function replaceNodeText(id,newText){

  var node = document.getElementById(id);

  while(node.firstChild)

      node.removeChild(node.firstChild);

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

}

posted @ 2015-10-26 21:57  Yaolina  Views(173)  Comments(0Edit  收藏  举报