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

          導航

          統計

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 阳东县| 元阳县| 特克斯县| 昭平县| 亳州市| 淳化县| 赤峰市| 伽师县| 鸡泽县| 厦门市| 隆安县| 绥德县| 鹿泉市| 济源市| 四会市| 乌兰浩特市| 合作市| 波密县| 长顺县| 凯里市| 桓台县| 恩平市| 烟台市| 林甸县| 达孜县| 余干县| 化隆| 荔浦县| 出国| 望谟县| 凤山市| 宜黄县| 玛曲县| 敦化市| 柘城县| 镇康县| 绥德县| 霍城县| 手机| 安国市| 屯留县|