模式窗口的使用

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <script>  //补充完成下边的函数,打开新的一个模式窗口  function openShowModalDialog(){      var obj = window;      var params  = new Array("aaaa",obj);

  var returnValue = window.showModalDialog("DEMO04_01.html",params);

  document.getElementById("showContentDiv").innerHTML=returnValue;

 }

  </script>

</head>

<body>

<h1>模式窗口的使用:</h1> <h3>补充完成openShowModalDialog函数,打开新的一个模式窗口</h3> <button onclick="openShowModalDialog();">打开新的模式窗口</button> <br> <hr> <div id="showContentDiv">

</div>   </body> </html>

DEM004-01.html

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

<script>

 //补充完成函数,将文本框returnValue的值设置为父窗口返回值,并关闭本窗口  function closeShowModalDialog(){        //获得模式窗体的参数。         var p = window.dialogArguments;          window.returnValue=document.getElementById("returnValue").value;      //设置父窗体的返回值 p[1] 事实上是拿到了父窗体的引用      p[1].returnValue=document.getElementById("returnValue").value;

     window.close();  }   </script>

</head>

<body>

<h1>模式窗口的使用:</h1> <h3>补充完成closeShowModalDialog函数,将文本框returnValue的值设置为父窗口返回值,并关闭本窗口</h3> <button onclick="closeShowModalDialog();">设置返回值,并关闭窗口</button> <hr> 窗口的返回值 <input type="text" id="returnValue" value="在这里设置返回值">   </body> </html>

posted @ 2008-06-15 12:27  shine_panda  阅读(236)  评论(0编辑  收藏  举报