function add()
  {
  
  var value=window.showModalDialog("./Subject/subjectadd.jsp",null,"dialogwidth:600px;dialogheight:400px");
  
  }<input type="button" value="新增" style="width:50px; height:40px;" onclick="add()"/>
我点击新增按钮,然后弹出一个对话框。我在刚刚弹出来的对话框里面,写完表单的数据后。点击保存按钮,想自动关闭当前对话框,并且返回到开始的父对话框。请问怎么写?  麻烦各位了,真不好意思,我实在写不出来了。不是我没有想。<input type="submit" name="save1" value="保 存" style="width:100px; height:35px;"/>小弟三叩首拜上。

解决方案 »

  1.   

    <input type="submit" name="save1" value="保 存" style="width:100px; height:35px; onclick="window.close();""/>
      

  2.   

    你直接window.close()不行吗??
      

  3.   

    function save(){
      window.returnValue= "你要返回的值";
      window.close();
    }
      

  4.   


    <input type="submit" name="save1" value="保 存" style="width:100px; height:35px;" onclick="close()"/>function close(){
    window.close();
    location.href="父对话框.html";
    }
      

  5.   

    楼上的,我点击保存按钮 。   到底是按照submit表单提交   还是按照onclick提交?
      

  6.   

    那你就submit提交到后台,输出关闭脚本到前台执行
      

  7.   

    <form>
    <input type="text" name="username" value=""/>
    <input type="submit" name="save1" value="保 存" style="width:100px; height:35px;" onclick="close()"/>
    </form>
    <script>
    function close(){
    var form = document.form[0];
    var input_box = form.getElementsByName('username');
    window.returnValue = input_box.value;
    window.close();
    window.event.returnValue = false;
    }
    </script>