caoyinghui

模式窗口的使用

<!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>

作者:caoyinghui1986 发表于2008-6-15 12:27:00 原文链接
阅读:365 评论:0 查看评论

posted on 2008-06-15 04:27 shine_panda 阅读(424) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航:
 
<2008年6月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

导航

统计

常用链接

留言簿

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜