caoyinghui

          框架中取值問題

          DEM003.html

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
          
          <html xmlns="http://www.w3.org/1999/xhtml">
          
          <head>
          
          </head>
          
          
          
          <frameset rows="70,*" cols="*" framespacing="0" frameborder="yes" style="border:0px">
          
            <frame src="DEMO03_bar.html" name="bar" scrolling="No" noresize="noresize" id="bar"arginwidth="0" marginheight="0" />
          
            <frameset cols="150,*" frameborder="yes" border="1" framespacing="0">
          
              <frame src="DEMO03_menu.html" name="menu" scrolling="No" noresize="noresize" id="menu" marginwidth="0" marginheight="0" />
          
              <frame src="DEMO03_main.html" name="mainFrame" id="main" marginwidth="0" marginheight="0" />
          
            </frameset>
          
          </frameset>
          
          <noframes><body>
          
          </body>
          
          </noframes></html>
          
          

          DEM003_bar.html

          <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <script>  //補充完成此函數,用于刷新Menu窗體的頁面  function flushMenuFrame(){      //top表示頂級窗口 的 window對象   window.top.menu.location.href="DEMO03_menu.html";  }  

           //補充完成此函數,將barText文本框的值寫入到Main窗口的mainText中去。  function writeValueToMainFrame(){      //parent表示 但前窗口的 上級窗口的 window對象        window.parent.mainFrame.document.getElementById("mainText").value=document.getElementById("barText").value;    } </script>

          </head>

          <body> <center>BAR頁面</center> <button onclick="flushMenuFrame();">刷新框架Menu窗口的頁面</button> Bar頁面的文本框:<input type="text" id="barText" value="Bar頁面的值1"><button onclick="writeValueToMainFrame();">向Main窗口寫值</button> </body> </html>

          DEMO003_main.html

          <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> </head>

          <body> <center>Main窗體</center> <br><br> Main窗體中的文本框 <input type="text" id="mainText" value="Main頁面的值2"> </body> </html>

           

          作者:caoyinghui1986 發表于2008-6-15 12:24:00 原文鏈接
          閱讀:267 評論:0 查看評論

          posted on 2008-06-15 04:24 shine_panda 閱讀(78) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          <2008年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          導航

          統計

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 阳西县| 社旗县| 淄博市| 兴安县| 都匀市| 刚察县| 嘉鱼县| 金秀| 吴江市| 平邑县| 修水县| 铜陵市| 济源市| 十堰市| 山东省| 梓潼县| 鱼台县| 青岛市| 穆棱市| 鸡泽县| 中宁县| 鹤山市| 宿松县| 吴旗县| 武宁县| 昭苏县| 鹿邑县| 漾濞| 威海市| 德江县| 西盟| 黑河市| 封丘县| 大化| 静海县| 朝阳县| 奉新县| 休宁县| 哈尔滨市| 奎屯市| 兰州市|