取本页面的代码??
你要是这个? document.body.innerHTML

解决方案 »

  1.   

    呵呵,是啊,用innerHTML或outerHTML
      

  2.   

    如何动态添加,我试了,不能输出menu,它到了下一页。
      

  3.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD><BODY>
    <style type="text/css">
    <!--
    .t {  filter: Alpha(Opacity=50)}
    td {  font-size: 12px; line-height: 22px}
    a:link {  color: #FFFFFF; text-decoration: none; height: 20px; width: 63px; border-color: #33CCFF #30CCFF #30CCFF; background-color: #0099FF; border-style: solid; border-top-width: 1px; border-left-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
    a:visited {  color: #FFFFFF; text-decoration: none; height: 20px; width: 63px; border-color: #33CCFF #30CCFF #30CCFF; background-color: #0099FF; border-style: solid; border-top-width: 1px; border-left-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
    a:hover {  background-color: #FF66FF; height: 20px; width: 61px; border: #FFFFFF; border-style: dotted; border-top-width: 1px; border-left-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
    -->
    </style>
    <table border = 1>
    <tr  id = "asd" oncontextmenu="window.event.returnValue=false;show_div();"><td>asdf</td></tr>
    <tr  id = "dfgdf" oncontextmenu="window.event.returnValue=false;show_div()"><td>asdfsd</td></tr>
    </table><SCRIPT language=javascript>
    function show_div()
    {
        var str = "";
    str += "<div id=Layer2 style=\"display:'none'\">";
    str += "<table width=100% border=0 cellspacing=0 cellpadding=0 height=100%><tr>";
    str += "<td align=center valign=top><font color=#FFFFFF >订餐<br>";
    str += "<a href=aomen.aspx target=mainFrame>澳门街订餐</a><br>";
    str += "<a href=right.aspx target=mainFrame>普通订餐</a><br>";
    str += "<a href=\"#;\">第三项</a><br></font></td></tr></table></div>";
    document.writeln( str );
    document.all.Layer2.style.display = '';
    }
    </SCRIPT>
    </BODY>
    </HTML>
      

  4.   

    这样试试
    <BODY>
    <style type="text/css">
    <!--
    .t {  filter: Alpha(Opacity=50)}
    td {  font-size: 12px; line-height: 22px}
    a:link {  color: #FFFFFF; text-decoration: none; height: 20px; width: 63px; border-color: #33CCFF #30CCFF #30CCFF; background-color: #0099FF; border-style: solid; border-top-width: 1px; border-left-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
    a:visited {  color: #FFFFFF; text-decoration: none; height: 20px; width: 63px; border-color: #33CCFF #30CCFF #30CCFF; background-color: #0099FF; border-style: solid; border-top-width: 1px; border-left-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
    a:hover {  background-color: #FF66FF; height: 20px; width: 61px; border: #FFFFFF; border-style: dotted; border-top-width: 1px; border-left-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
    -->
    </style>
    <table border = 1>
    <tr><td id = "asd" oncontextmenu="window.event.returnValue=false;show_div(this);">asdf</td></tr>
    <tr><td id = "dfgdf" oncontextmenu="window.event.returnValue=false;show_div(this)">asdfsd</td></tr>
    </table><SCRIPT language=javascript>
    function show_div(obj)
    {
        var str = "";
    str += "<div id=Layer2>";
    str += "<table width=100% border=0 cellspacing=0 cellpadding=0 height=100%><tr>";
    str += "<td align=center valign=top><font color=#FFFFFF >订餐<br>";
    str += "<a href=aomen.aspx target=mainFrame>澳门街订餐</a><br>";
    str += "<a href=right.aspx target=mainFrame>普通订餐</a><br>";
    str += "<a href=\"#;\">第三项</a><br></font></td></tr></table></div>";
    obj.innerHTML += str; //如果只想出现 menu 的话, 直接用 obj.innerHTML = str; 就行了
    }
    </SCRIPT>
    </BODY>