夢想飛翔

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

          父子頁面傳值問題!

          Posted on 2009-09-24 14:23 love1563 閱讀(1400) 評論(0)  編輯  收藏 所屬分類: Java語言*初級版
          http://blog.csdn.net/yemy/archive/2006/10/25/1351413.aspx

          父頁面
          <html>
          <head>
              <title>無標題頁</title>
              <script language="javascript" type="text/javascript">
                    function opendialog1()
               {
                   var someValue=window.showModalDialog("b.html","","dialogWidth=500px;dialogHeight=500px;status=no;help=no;scrollbars=no");
                   document.form1.p1t.value=someValue;
               }

              </script>
          </head>
          <body>
              <form name="form1" action="#">
                  <input type="text" name="p1t">
                  <input type="button" value="打開對話框" onclick="opendialog1()">
              </form>
          </body>
          </html>
          子頁面
          <html>
          <head>
              <title>無標題頁</title>
              <script language="javascript" type="text/javascript">
              function a(wname)
              {
               parent.window.returnValue=wname;  //父窗口就是上一個頁面
             window.close();
              }
            </script>
          </head>
          <body>
              <form name="form1" action="">
                  <input type="button" value="傳值" onclick="return a('hello')">
              </form>
          </body>
          </html>
          <HTML>
          <HEAD>
          <TITLE> 子頁面 </TITLE>
          <SCRIPT LANGUAGE="JavaScript">
          <!--
          function getValue(str){
          window.opener.document.getElementById("text1").value=str;
          window.close();
          }
          //-->
          </SCRIPT>
          </HEAD>

          <BODY>
          <A href="" onclick="getValue('超聯接1')">超聯接1</A>
          <A href="" onclick="getValue('超聯接2')">超聯接2</A>
          <A href="" onclick="getValue('超聯接3')">超聯接3</A>
          <A href="" onclick="getValue('超聯接4')">超聯接4</A>
          </BODY>
          </HTML>

          主站蜘蛛池模板: 普兰店市| 赣榆县| 林西县| 青岛市| 东莞市| 分宜县| 汉川市| 襄垣县| 合江县| 马边| 武冈市| 洛隆县| 湟源县| 万荣县| 巨鹿县| 淳安县| 福鼎市| 茶陵县| 白玉县| 若尔盖县| 邹城市| 湘潭县| 六安市| 丽水市| 竹北市| 交口县| 随州市| 康保县| 枝江市| 城市| 阿瓦提县| 鹤山市| 襄汾县| 永城市| 万全县| 罗江县| 文昌市| 大化| 柯坪县| 北票市| 肥城市|