Your Ad Here
首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 网站建设 > 网页制作 > window.open()弹出居中的窗口
【标  题】:window.open()弹出居中的窗口
【关键字】:window.open
【来  源】:http://blog.csdn.net/laohoucn/archive/2006/08/10/1046144.aspx

window.open()弹出居中的窗口

Your Ad Here

Javascript代码

function openwindow(url,name,iWidth,iHeight)
 {
  var url;                                 //转向网页的地址;
  var name;                           //网页名称,可为空;
  var iWidth;                          //弹出窗口的宽度;
  var iHeight;                        //弹出窗口的高度;
  var iTop = (window.screen.availHeight-30-iHeight)/2;       //获得窗口的垂直位置;
  var iLeft = (window.screen.availWidth-10-iWidth)/2;           //获得窗口的水平位置;
  window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
 }

使用时调用这个函数即可。如:

<a href="javascript:void(0);" onclick="javascript:openwindow('a.html','',400,200);">转到a</a>

缺点:与原窗口的大小,位置无关。

CSS中浏览器解决方案 一:【上一篇】
MSSQLCracker in ASP:【下一篇】
【相关文章】
  • 脚本中出现 window.open() access is denied - 拒绝访问 情况一则及分析
  • 弹出窗口window.open的用法
  • JS中Window.Open(),想用GUID做窗口Name竟然不行!!!
  • window.open()支持环境
  • javascript the attributes of the window.open
  • window.open()的所有参数列表 (转载)
  • 一种在父窗口中得知window.open()出的子窗口关闭事件的方法
  • window.open()的所有参数列表
  • 用Open()打开窗口的异同
  • 【随机文章】
  • 环境的测试电影模式下测试, 所有SWF文件必须存放
  • 如何避免职业生涯规划的盲点?
  • RPM使用方法
  • 实现report视图下任何列头的双向排序
  • 轻量级持久层框架的讨论(代码与模板_V2)
  • 关于动态加载程序集
  • 数据库日常维护
  • 女儿墙的由来
  • FreeHand实例—绘制足球(2)
  • ant学习
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 bbb软讯网络 All Rigths Reserved.