zoukankan      html  css  js  c++  java
  • JS只弹出一个居中弹出窗口

    var newWindow;//定义一个窗口,有利于窗口间的通讯
    function makeNewWindow(url) {
       if (!newWindow || newWindow.closed) {
            var width = 400;
            var height = 300;
            var left = parseInt((screen.availWidth/2) - (width/2));//屏幕居中
            var top = parseInt((screen.availHeight/2) - (height/2));
            var windowFeatures = "width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;
            newWindow = window.open(url, "subWind", windowFeatures);
        } else {
            // window is already open, so bring it to the front
            newWindow.focus();
        }
    }

    window.open 弹出新窗口的命令; 
    page.html 弹出窗口的文件名; 
    newwindow 弹出窗口的名字(不是文件名),非必须,可用空''代替; 
    height=100 窗口高度; 
    width=400 窗口宽度; 
    top=0 窗口距离屏幕上方的象素值; 
    left=0 窗口距离屏幕左侧的象素值; 
    toolbar=no 是否显示工具栏,yes为显示; 
    menubar,scrollbars 表示菜单栏和滚动栏。 
    resizable=no 是否允许改变窗口大小,yes为允许; 
    location=no 是否显示地址栏,yes为允许; 
    status=no 是否显示状态栏内的信息(通常是文件已经打开),yes为允许; 

  • 相关阅读:
    Oracle11g 修改内存配置
    七.从按键输入到GPIO通用驱动
    三.C语言版本的LED驱动试验
    五.NXP恩智浦官方SDK使用
    前期准备——1.Makefile的使用及基本语法
    八.主频及时钟配置
    四.指针形式对寄存器进行操作(类似STM32效果)
    二.I.MX6U的启动方式
    六.蜂鸣器驱动
    六.项目的BSP工程管理
  • 原文地址:https://www.cnblogs.com/flyrain/p/Jsopenwindow.html
Copyright © 2011-2022 走看看