<script language="JavaScript"><!--
function save()  //保存此页面

  var winSave = window.open();
  winSave.document.open("text/html","gb2312");
  winSave.document.write(myTable.outerHTML); //取得表格saveTable的HTML代码
  winSave.document.execCommand ("SaveAs",true,"系统公告-[<%=str_title%>]");
  winSave.close();
}

解决方案 »

  1.   

    <html>
    <head>
    <title>无标题</title>
    <head>
    <body>
    <input type=button value="click" id=button >
    <script language ='javascript'>
    <!--
    var html = null;function button.onclick(){
           alert("html = \n" + html);        
           alert("html = \n" + (html = document.all[0].outerHTML));
    }
    //-->
    </script>
    </body>
    </html>
      

  2.   

    多谢了,但有一点小问题我原来的页面原来只有一个table ,无<htmL><head></head><body></body></html>
    这些东西的,用了上面的方法之后,自动加上了<htmL><head></head><body></body></html>
    能不能去掉?
      

  3.   

    把页面放到一个iframe中,id为f1,用document.frames.f1.getHTML(ture)
      

  4.   

    <script language=javascript>
    function showHTML()
    {
    var str=document.documentElement.outerHTML;
    alert(str)
    }
    </script>
    <input name=button1 type=button value="得到页面的HTML" onclick=showHTML()>
      

  5.   

    to hbhbhbhbhb1021(天外水火(我要多努力)) ,这个代码在firefox里 得到的undefined