http://www.csdn.net/develop/Read_Article.asp?Id=15113

解决方案 »

  1.   

    index.htm
    <html><head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>新建网页 1</title>
    <script language>
    function show_time(){
       document.form1.t1.value=window.showModalDialog("input_time.htm")
    }
    </script>
    </head><body><form name="form1" method="POST" action="">
      <p>
      <input type="text" name="t1" size="56"></p>
      <p><input type="button" value="点击输入日期和时间" name="B1" onClick="show_time()"></p>
    </form></body></html>
    ****************************
    input_time.htm(showModalDialog)<html><head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>时间输入</title>
    <script language="javascript">
    function okbutton(){
       var now=new Date();
       var hours=now.getHours();
       var min=now.getMinutes();
       window.returnValue=form1.t1.value+"-"+form1.t2.value+"-"+form1.t3.value+"  填写时间为  "+hours+":"+min;
       window.close();
    }
    function cancelbutton(){
       window.returnValue="您没有填写完全";
       window.close();
    }</script>
    </head><body><form name="form1" method="POST" action="">
       <input type="text" name="t1" size="20" value="">请输入年</p>
     <p>
      <input type="text" name="t2" size="20" value="">月</p>
     <p>
      <input type="text" name="t3" size="20" value="">日</p>
     <p align="center">
      <input type="button" value="OK" name="B1" onClick="okbutton()">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input type="button" value="Cancel" name="B2" onClick="cancelbutton()"></p>
    </form></body></html>
      

  2.   

    test.html
    <HTML><BODY>
    <input type="text" id="txt" size=20>
    <script>
    function show(){
    x = showModalDialog("testnew.html",window,"dialogWidth:400px;dialogHeight:300px;status:no;");
    txt.value = x;
    }
    </script>
    <input type=button value=open onclick="show()">
    </BODY></HTML>testnew.html------------------------
    <HTML><BODY>
    <input type="text" name="dlgtxt">
    <button onclick="doSomething()">do somthing</button>
    <SCRIPT>MyText="A Popup Example"</SCRIPT>
    <script>
    function doSomething(){
      returnValue = dlgtxt.value;
      close();
    }
    </script>
    </BODY></HTML>
      

  3.   

    var k;
    var s = new Object();

    var bqnr

    s.bqnr = formEdit.bqnr.value;
    s.bqxh = formEdit.bqxh.value;

    var url
    if(formEdit.bqxh.value=="")
    {url="grbq_edit.asp";}
    else
    {url="grbq_edit.asp?bqxh=" + formEdit.bqxh.value;}
    k=showModalDialog(url,s,"dialogWidth:298px;status:no;dialogHeight:398px");
    传的是对象怎么办?
      

  4.   

    试试这段代码<script>
    var vDialog=null;
    function rdl_doDialog(){
    vDialog=showModelessDialog("rdl_showmodelessdialog_demo.html",window,"status:no;resizable:yes;dialogHeight:210px;dialogWidth:360px;unadorne:yes");
    }
    function rdl_setDialogValue(){
    if (vDialog != null) vDialog.idDialogInput.value=idOpenerInput.value;
    }
    </script>
    <input type=text id=idOpenerInput value="传递的文字"><br><br>
    <input type=button onclick="rdl_doDialog();" value="建立对话框">
    <input type=button onclick="rdl_setDialogValue();" value="传递文字">
    ---- 对话框页面的代码 ----<script>
    function window.onunload() {
    dialogArguments.vDialog=null;
    }
    </script><input type=text id=idDialogInput><br><br>
    <input type=button onclick="dialogArguments.idOpenerInput.value=idDialogInput.value;" value="传递文字">
    <input type=button onclick="window.close();" value="关闭">