弹出窗口两种方式:
    1.window.showModalDialog:
      var feature = "dialogWidth:615px;dialogHeight:505px;status:no;help:no;scroll:no;resizable:no;center:yes";
      window.showModalDialog(url, Object(传给弹出窗口的参数,可以是任何类型),feature) 
      决定窗口的外观是第三个参数feature,其中center属性指定为"yes",弹出窗口居中;
      如果想手动指定弹出窗口的具体位置,去掉center属性,
       用dialogTop(弹出窗口上边界居屏幕上的距离)
       dialogLeft(弹出窗口左边界居屏幕左的距离)属性
      如:(距离是px像素),这里手动指定弹出窗口位置居中
      var iTop = (window.screen.availHeight-550)/2; //获得窗口的垂直位置,550为弹出窗口的height;
      var iLeft = (window.screen.availWidth-640)/2; //获得窗口的水平位置,640为弹出窗口的width;
      var feature = "dialogWidth:640px;dialogHeight:550px;status:no;help:no;scroll:no;resizable:no;dialogTop:'+iTop+';dialogLeft:'+iLeft+';";
    2.window.open:  
      var feature = "width=615,height=505,menubar=no,toolbar=no,location=no,scrollbars=no,status=no,modal=yes"
      window.open(url, "name(只能为字符串,不能传window)", feature) 
      手动指定弹出窗口位置,属性top:(弹出窗口上边界居屏幕上的距离)
                            属性left:(弹出窗口左边界居屏幕左的距离)
      下面指定弹出窗口位置居中(这种方式没有center属性):
       var iTop = (window.screen.availHeight-550)/2; //获得窗口的垂直位置,550为弹出窗口的height;
      var iLeft = (window.screen.availWidth-640)/2; //获得窗口的水平位置,640为弹出窗口的width;
      var feature = "width=615,height=505,top="+iTop+",left="+iLeft+",menubar=no,toolbar=no,location=no,scrollbars=no,status=no,modal=yes";
   
   子窗口调用父窗口的东东(控件或者方法):
   1. window.open打开的子窗口有window.opener属性
     子窗口通过window.opener.xxxx获得父窗口的东东。
     如:window.opener.document.getElementById("userName");得到父页面的控件。
       window.opener.fresh();调用父页面的js方法。
   2. window.showModalDialog:不支持window.opener,
      子窗口通过window.dialogArguments.xxxx获得父窗口的东东。
      父窗口通过showModalDialog(url,para,feature)第二个参数para传参数给子窗口,
      子窗口通过window.dialogArguments获得父窗口穿过来的东西。
      
      如:这里传父页面的window过去
        父页面:showModalDialog(url,window,feature)
       子页面:var name = window.dialogArguments.document.getElementById("userName").value;得到父页面的控件。
            var name = window.dialogArguments.fresh();调用父页面的方法。
      这里的window.dialogArguments里的window代表父页面的window,它是通过showModalDialog方法的第二个参数window传过来的,
      当然也可以传数组或其它变量。

调用js方法实际上是这样:window.方法名();

window.open()与window.showModalDialog的更多相关文章

  1. JavaScript(Iframe、window.open、window.showModalDialog)父窗口与子窗口之间的操作

    一.Iframe 篇 公共部分 //父对象得到子窗口的值 //ObjectID是窗口标识,ContentID是元素ID function GetValue(ObjectID,ContentID) { ...

  2. 总结JavaScript(Iframe、window.open、window.showModalDialog)父窗口与子窗口之间的操作

    一.Iframe 篇 //&&&&&&&&&&&&&&&&&&a ...

  3. 总结js(Iframe、window.open、window.showModalDialog)父窗口与子窗口之间的操作

    http://hi.baidu.com/yashua839/blog/item/131fdb2fe547ef221f3089af.html一.Iframe 篇 //&&&&am ...

  4. window.open()与window.showModalDialog区别

    window.open()与window.showModalDialog区别 弹出窗口两种方式:    1.window.showModalDialog:      var feature = &qu ...

  5. window.open、window.showModalDialog和window.showModelessDialog 的区别[转]

    一.前言 要打开一个可以载入页面的子窗口有三种方法,分别是window.open.window.showModalDialog和window.showModelessDialog. open方法就是打 ...

  6. window.parent与window.opener、window.showModalDialog的区别 opener和showModalDialog刷新父页面的方法

    项目中使用案例: 父窗体 <s:form namespace="/forexagent" id="listSearchForm" name="t ...

  7. (转)window.open和window.showModalDialog的区别

    window.open和window.showModalDialog区别: 1.都是在IE上打开新窗口,只不过前者是非阻塞式,也可以说非模态窗口.而后者是阻塞式模态窗口.阻塞或者模态窗口,只有你把当前 ...

  8. window.parent与window.openner区别介绍

    今天总结一下js中几个对象的区别和用法: 首先来说说 parent.window与top.window的用法 "window.location.href"."locati ...

  9. window.onload和window.document.readystate的探究

    在编写前端页面的时候,我们时常需要对页面加载的状态进行判断,以便进行相应的操作. 比如在移动端,时常需要在页面完全加载完成之前,先显示一个loading的图标,等待页面完成加载完成后,才显示出真正要展 ...

  10. window.location.href = window.location.href 跳转无反应 a 超链接 onclick 点击跳转无反应

    错误写法 , 主要是在 href="#"这里 <a href="#" id="send" onclick="return b ...

随机推荐

  1. Java字符串 API

    常用API

  2. ssh: connect to host 192.168.11.180 port 22: Connection refused

    错误原因: 1.sshd 未安装:sudo apt-get install openssh-server 2.sshd 未启动:sudo net start sshd 3.防火墙:sudo ufw d ...

  3. close_on_exec标志位的作用

    转自:http://blog.csdn.net/sunlylorn/article/details/6363727 close_on_exec 是一个进程所有文件描述符(文件句柄)的位图标志,每个比特 ...

  4. SQL Server 调优系列基础篇 - 索引运算总结

    前言 上几篇文章我们介绍了如何查看查询计划.常用运算符的介绍.并行运算的方式,有兴趣的可以点击查看. 本篇将分析在SQL Server中,如何利用先有索引项进行查询性能优化,通过了解这些索引项的应用方 ...

  5. Keil 中文显示乱码解决办法

    在将代码文件转换成UTF-8之前还要把Keil的环境也设置成UTF-8的模式,方法是:“Edit”——〉“Configuration...”——〉“Encoding”,选择“Encode in UTF ...

  6. 常用docker

    随便什么版本的linux 接入daocloud.io 在发现镜像中选择DockerHub 搜索对应的image,然后部署. 手动输入YAML即可 aria: image: cuteribs/aria2 ...

  7. sqljdbc 无法连接到主机

    今天发现sqljdbc 无法连接到SQL Server 主机.原因是SQL Server Browser 服务没有打开

  8. L220

    He must not allow this unusual barrier (obstacle) to stop him from fighting against the enemy.他绝不能让这 ...

  9. Linux内核参数优化记录

    //fs.file-max 最大打开文件数 //fs.nr_open=20480000 单个进程允许打开的文件句柄上限 //信号量及共享内存,可以使用ipcs -l来获取 //kernel.sem 信 ...

  10. makefile for opencv

    makefile #################################################### # Generic makefile - 万能Makefile # for ...