如何用Javascript为一个网页动态地添加DOCTYPE声明?<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

解决方案 »

  1.   

    可以这样用:
    var test1 = document.createElement("<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>");
    但是不知道这东西有什么实际意义?
      

  2.   


    怎么将它加到HTML元素的上面?没啥意义,就是随便问问。。
      

  3.   

    查看我知道用alert(document.firstChild.nodeValue)
      

  4.   


    怎么添加到HTML元素的上面呢..