主要的是想把这些HTML代码另存为为一个.HTML文件,
谢谢拉

解决方案 »

  1.   

    想保存代码??
    var o=window.open();
    o.document.open();
    o.document.write("<p>asdf</p>");
    o.document.write("<p>dddd</p>");
    o.document.close();
    o.document.execCommand("saveas");
    o.close()
      

  2.   

    我想保存一个表格的纯HTML代码到 .html文件
      

  3.   

    <script>
    var str="<p>ddddddddddddddd</p>";
    str=str.replace(/\</g,'&lt').replace(/\>/g,'&gt');
    alert(str);
    document.write(str);
    </script>
      

  4.   

    晕!
    你说清楚,是想存为HTML文件
    还是想在页面上显示HTML代码?
      

  5.   

    <table id="t">
      <tr>
        <td>1</td>
        <td>2</td>
      </tr>
      <tr>
        <td>1</td>
        <td>2</td>
      </tr>
    </table>
    <button onclick=eyun()>save</button>
    <script>
    function eyun()
      {var o=window.open();
       o.document.open();
       o.document.write(t.outerHTML);
       o.document.close();
       o.document.execCommand("saveas");
       o.close()
      }
    </script>