夢想飛翔

          自強不息
          posts - 111, comments - 30, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

          html框架之間的關系

          Posted on 2007-08-09 10:52 love1563 閱讀(379) 評論(0)  編輯  收藏 所屬分類: JSP/Servlets/JSF

          如下代碼:
          index.htm:
          ??? <head>
          ??????? <title>Frameset Example</title>
          ??? </head>
          ??? <frameset rows="100,*">
          ??????? <frame src="frame.htm" name="topFrame" />
          ??????? <frameset cols="50%,50%">
          ??????????? <frame src="anotherframe.htm" name="leftFrame" />
          ??????????? <frame src="yetanotherframe.htm" name="rightFrame" />
          ??????? </frameset>
          ??? </frameset>

          bule.htm

          <head>

          <script language="javascript" type="text/javascript">
          ?function doBlur(value,tag) {

          ??if (tag == "bluetest1") {
          ???parent.frames[0].document.getElementById("redtest1").value = value;
          ???top.frames[2].document.getElementById("righttest1").value = value;
          ??} else {
          ???parent.frames[0].document.getElementById("redtest2").value = value;
          ???top.frames[2].document.getElementById("righttest2").value = value;
          ??}
          ??
          ?}


          </script>
          <title>blueFrame</title>
          </head>
          <body>
          ??? <h1>blueFrame</h1>
          ??? <table border="1">
          ??????? <tr>
          ??????????? <td>window.name =</td><td><script>document.write(window.name)</script></td>
          ??????? </tr>
          ??????? <tr>
          ??????????? <td>top.name =</td><td><script>document.write(top.frames[2].name)</script></td>
          ??????? </tr>
          ??????? <tr>
          ??????????? <td>parent.name =</td><td><script>document.write(parent.frames[1].name)</script></td>
          ??????? </tr>
          ??? </table>
          ???
          ??? bluetest1:
          ?<input type="text" name="test1" onblur ="doBlur(this.value,'bluetest1');" /><br><br>

          ?bluetest2:
          ?<input type="text" name="test2" onblur ="doBlur(this.value,'bluetest2');" /><br><br>
          </body>

          red.htm
          <head>
          <title>redFrame</title>
          </head>
          <body>
          ??? <h1>redFrame</h1>
          ??? <table border="1">
          ??????? <tr>
          ??????????? <td>window.name =</td><td><script>document.write(window.name)</script></td>
          ??????? </tr>
          ??????? <tr>
          ??????????? <td>top.name =</td><td><script>document.write(parent.parent.frames[1].frames[1].name)</script></td>
          ??????? </tr>
          ??????? <tr>
          ??????????? <td>parent.name =</td><td><script>document.write(parent.frames[1].name)</script></td>
          ??????? </tr>
          ??? </table>
          ??????? redtest1:
          ?<input type="text" name="redtest1"? /><br><br>

          ?redtest2:
          ?<input type="text" name="redtest2"? /><br><br>

          </body>

          frame.htm
          <head>
          <title>topFrame</title>
          </head>
          <body>
          ??? <h1>topFrame</h1>
          ??? <table border="1">
          ??????? <tr>
          ??????????? <td>window.name =</td><td><script>document.write(window.name)</script></td>
          ??????? </tr>
          ??????? <tr>
          ??????????? <td>top.name =</td><td><script>document.write(top.name)</script></td>
          ??????? </tr>
          ??????? <tr>
          ??????????? <td>parent.name =</td><td><script>document.write(parent.name)</script></td>
          ??????? </tr>
          ??? </table>
          </body>

          anotherframe.htm
          ?? <head>
          ??????? <title>Frameset Example</title>
          ??? </head>
          ??? <frameset cols="50%,50%">
          ??????? <frame src="red.htm" name="redFrame" />
          ??????? <frame src="blue.htm" name="blueFrame" />
          ??? </frameset>
          yetanotherframe.htm
          <head>
          <title>rightFrame</title>
          </head>
          <body>
          ??? <h1>rightFrame</h1>
          ??? <table border="1">
          ??????? <tr>
          ??????????? <td>window.name =</td><td><script>document.write(window.name)</script></td>
          ??????? </tr>
          ??????? <tr>
          ??????????? <td>top.name =</td><td><script>document.write(top.name)</script></td>
          ??????? </tr>
          ??????? <tr>
          ??????????? <td>parent.name =</td><td><script>document.write(parent.name)</script></td>
          ??????? </tr>
          ??? </table>
          ???
          ??? righttest1:
          ?<input type="text" name="righttest1" /><br><br>

          ?righttest2:
          ?<input type="text" name="righttest2" /><br><br>
          </body>

          運行效果:
          frames.bmp

          主站蜘蛛池模板: 静宁县| 玉龙| 绥江县| 依兰县| 崇明县| 佛学| 天水市| 绥化市| 清涧县| 和龙市| 利川市| 荔浦县| 八宿县| 拉孜县| 北辰区| 新竹市| 桃园市| 麻栗坡县| 上思县| 萝北县| 阿图什市| 泾川县| 常山县| 甘南县| 吉隆县| 株洲市| 大安市| 中西区| 延津县| 白河县| 北宁市| 金堂县| 焉耆| 沂南县| 青铜峡市| 章丘市| 荣成市| 汉源县| 阳东县| 哈密市| 同心县|