要不就 xml+xsl, 在 html 里定义这些不怎么爽.

解决方案 »

  1.   

    现在没办法呀,只能在html里做^_^
      

  2.   

    不好意思,最近蛮忙的,呵呵,在IE下,可用document.namespaces来做的,在XML里可用createProcessingInstruction方法来追加头<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <title> - http://www.never-online.net </title>
        <style type="text/css" media="all" title="Default">
          menu\:item { background-color:#eee; color:blue;}
        </style>
        <script type="text/javascript">
        //<![CDATA[
          var a = document.documentElement;
          var o = document.namespaces.add("menu","www.never-online.net")
          alert(a.outerHTML)
        //]]>
        </script>
      </head>
      <body id="www.never-online.net">
        <menu:item>BlueDestiny</menu:item>
      </body>
    </html>
      

  3.   

    顺便说一下,如果用document.documentElement.setAttribute("xmlns:menu","www.never-online.net")
    在outerHTML里也可以得到我们目的的HTML,但并不把它应用到整个文档。