要不把菜单也放到Iframe里好了

解决方案 »

  1.   

    http://expert.csdn.net/Expert/topic/2992/2992220.xml?temp=.6203577
      

  2.   

    http://msdn.microsoft.com/downloads/samples/internet/ie55/MenuBehavior/default.asp?frame=true
      

  3.   

    我是想实现这样的功能:
    点击菜单项,然后在iframe中显示相应网页,如果都放在frame里好像实现不了吧上面两种方法我还没试,最好帮我调试一下啦,我对javascript不太熟悉啊 :)
      

  4.   

    52juanjuan(Fibona) 的也是一个好办法,我下次会采用
    但是这样要修改的文件比较多,所以还是想把菜单浮在上面
      

  5.   

    MSDNdemo.htm<html>
    <head>
    <title>网页跨框架菜单 </title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head><frameset rows="92,*" cols="*" framespacing="4" frameborder="yes" border="4">
      <frame src="top.htm" name="topFrame" scrolling="NO" >
      <frame src="bottom.htm" name="mainFrame">
    </frameset>
    <noframes><body></body></noframes>
    </html>
    top.htm<html>
    <head>
    <title>MSDN的示例</title>
    <script>
    var oPopup = window.createPopup();
    function richContext()
    {
        var lefter2 = event.offsetY+0;
        var topper2 = event.offsetX+15;
        oPopup.document.body.innerHTML = oContext2.innerHTML; 
        oPopup.show(topper2, lefter2, 210, 84, contextobox);
    }
    </script>
    </head>
    <body> <span id="contextobox" style="  cursor:hand; margin-left:5px; margin-right:10px; background:#e4e4e4; width:300; height:40; padding:20px;" oncontextmenu="richContext(); return false"  >Right-click inside this box.</span><DIV ID="oContext2" STYLE="display:none">
    <DIV STYLE="position:relative; top:0; left:0; border:2px solid black;  border-top:2px solid #cccccc; border-left:2px solid #cccccc; background:#666666; height:110px; width:207px;"> 
      <DIV STYLE="position:relative; top:0; left:0; background:#cccccc; border:1px solid black; border-top: 1px solid white; border-left:1px solid white; height:20px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:hand" onmouseover="this.style.background='#ffffff'" onmouseout="this.style.background='#cccccc'" onclick="top.mainFrame.location.href='http://www.microsoft.com';"> 
        &nbsp;&nbsp;Home</DIV>
      <DIV STYLE="position:relative; top:0; left:0; background:#cccccc; border:1px solid black; border-top: 1px solid white; border-left:1px solid white; height:20px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:hand" onmouseover="this.style.background='#ffffff'" onmouseout="this.style.background='#cccccc'" onclick="top.mainFrame.location.href='http://search.microsoft.com';"> 
        &nbsp;&nbsp;Search</DIV>
      <DIV STYLE="position:relative; top:0; left:0; background:#cccccc; border:1px solid black; border-top: 1px solid white; border-left:1px solid white; height:20px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:hand" onmouseover="this.style.background='#ffffff'" onmouseout="this.style.background='#cccccc'" onclick="top.mainFrame.location.href='http://www.microsoft.com/ie';"> 
        &nbsp;&nbsp;Intenet Explorer</DIV>
      <DIV STYLE="position:relative; top:0; left:0; background:#cccccc; border:1px solid black; border-top: 1px solid white; border-left:1px solid white; height:20px; color:black; font-family:verdana; font-weight:bold; padding:2px; padding-left:10px; font-size:8pt; cursor:hand" onmouseover="this.style.background='#ffffff'" onmouseout="this.style.background='#cccccc'" onclick="top.mainFrame.location.href='http://www.microsoft.com/info/cpyright.htm';"> 
        &#169;2001 Microsoft Corporation</DIV>
    </DIV></body>
    </html>
    bottom.htm<html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head><body></body>
    </html>
      

  6.   

    bencalie(Bencalie) 提供的方法实现了我想要的功能,但是又出现一个小问题,大家看看下面这页:http://218.20.188.131/test/menu/menu.htm开头处出现了“HEAD>”,我检查过好像没错呀
    源文件下载:
    http://218.20.188.131/test/menu/menu.zipmenu.htm:<HTML XMLNS:myMenu>
    <?IMPORT namespace="myMenu" implementation="menu.htc" />
    HEAD></HEAD>
    <BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="font-family:verdana; font-size:70%">
    <div style="padding:0px; background:#ffffff; border:0px outset #cccccc; width:100%; height:100%">
    <myMenu:menu id="All_Products" onsubmenu_click="doFunction()" >All 
      Products <myMenu:menu id="Downloads">Downloads</myMenu:menu> <myMenu:menu id="Product_Catalog">MS 
      Product Catalog</myMenu:menu><myMenu:menu id="Accessibility">Microsoft Accessibility</myMenu:menu> 
      </myMenu:menu>
    <myMenu:menu id="Support" onsubmenu_click="doFunction()">Support 
      <myMenu:menu id="KB">Knowledge Base</myMenu:menu> </myMenu:menu>
    <myMenu:menu id="Search" onsubmenu_click="doFunction()">Search 
      <myMenu:menu id="Search">microsoft.com Search</myMenu:menu> <myMenu:menu id="Web_Search">MSN 
      Web Search</myMenu:menu> </myMenu:menu>
    <myMenu:menu id="microsoft.com Guide" onsubmenu_click="doFunction()">microsoft.com 
      Guide <myMenu:menu id="Home">microsoft.com Home</myMenu:menu> <myMenu:menu id="MSN_Home">MSN 
      Home</myMenu:menu> </myMenu:menu> 
    <Iframe id="oFrame" src="frame1.htm" width="100%" height="100%" style="border: 1px solid black;"></iframe>
    </div>
    </body>
    </html>
    <SCRIPT>
    function doFunction(){
        // Retrieve the result from the event object created in menu.htc.
        var x = event.result;
        // Switch the result value.
        switch(x){
            case "Downloads":
                document.all.oFrame.src = "http://msdn.microsoft.com/isapi/gomscom.asp?target=/downloads/";
                break;
            case "Product_Catalog":
                document.all.oFrame.src = "http://msdn.microsoft.com/isapi/gomscom.asp?target=/catalog/default.asp?subid=22";
                break;
            case "Accessibility":
                document.all.oFrame.src = "http://msdn.microsoft.com/isapi/gomscom.asp?target=/enable/"; 
                break;
            case "KB":
                document.all.oFrame.src = "http://support.microsoft.com/search/"; 
                break;
            case "Search":
                document.all.oFrame.src = "http://msdn.microsoft.com/isapi/gosearch.asp?target=/us/default.asp"; 
                break;
            case "Web_Search":
                document.all.oFrame.src = "http://search.msn.com/"; 
                break;
            case "Home":
                document.all.oFrame.src = "http://msdn.microsoft.com/isapi/gomscom.asp?target=/"; 
                break;
            case "MSN_Home":
                document.all.oFrame.src = "http://www.msn.com/"; 
                break;
            default:
                // Do nothing.
                break; 
        }
    }
    </SCRIPT>
     
      

  7.   

    晕~~ 是dreamweaver惹的祸,一预览就帮我删掉了“<”,真奇怪
    我用记事本编辑保存就好了
      

  8.   

    csdn论坛速度怎么这么慢啊,有时还进不去?