夢想飛翔

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

          父子頁面傳值問題!

          Posted on 2009-09-24 14:23 love1563 閱讀(1401) 評論(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>

          主站蜘蛛池模板: 千阳县| 黔东| 江达县| 山东省| 徐州市| 顺义区| 长兴县| 潞西市| 紫金县| 两当县| 烟台市| 噶尔县| 阿图什市| 南京市| 铜川市| 佛学| 大兴区| 陇西县| 承德市| 晋城| 神池县| 灵台县| 乌拉特前旗| 永州市| 闵行区| 固阳县| 宜都市| 安阳市| 滦南县| 易门县| 滨州市| 新乐市| 织金县| 东安县| 山阴县| 沁水县| 拜城县| 安图县| 沈阳市| 天气| 嵊州市|