zoukankan      html  css  js  c++  java
  • IE浏览器弹出窗口

    //弹出一个对话框 参数的顺序: url, iWidth, iHeight, vArguments
    function openDialog() {
        var url, len = arguments.length, sFeatures, ret;
        if (len == 1) {
            url = arguments[0];
            var iWidth = 800; //弹出窗口的宽度;
            var iHeight = 600;  //弹出窗口的高度;
            return window.showModalDialog(url, "", "dialogWidth=" + iWidth + "px;dialogHeight=" + iHeight + "px;status=no;");
        }
        else {
            url = arguments[0];
            iWidth = arguments[1];
            iHeight = arguments[2];
            sFeatures = "dialogWidth=" + iWidth + "px;dialogHeight=" + iHeight + "px;status=no;";
            if (len == 3) ret = window.showModalDialog(url, "", sFeatures);
            else if (len == 4) ret = window.showModalDialog(url, arguments[3], sFeatures);
            return ret;
        }
    }
    //弹出一个新窗口 isres:是否可调整大小
    function windowOpen(url, iWidth, iHeight, isres) {
        var iTop = (window.screen.availHeight - 30 - iHeight) / 2; //获得窗口的垂直位置;
        var iLeft = (window.screen.availWidth - 10 - iWidth) / 2;  //获得窗口的水平位置;
        var rs;
        if (isres == undefined) rs = 'no';
        else rs = 'yes';
        window.open(url, "_blank", 'height=' + iHeight + ',width=' + iWidth + ',top=' + iTop + ',left=' + iLeft +
            ',toolbar=no,menubar=no,scrollbars=no,resizable=' + rs + ',location=no,status=no ');
    }

    用法

    openDialog('/test/test3.aspx?r=' + Math.random(), 1200, 600, window);//打开对话框
    windowOpen('/test/test3.aspx?r=' + Math.random(), 1200, 600);//打开新窗口
    openDialog()这种方法已经不适用了,多数浏览器已经不支持,只有IE模式下支持
  • 相关阅读:
    初识线段树
    win7下vc6.0打开文件未响应的解决方法
    SQL 2008安装
    20200730 Div.2模拟赛题解
    20190928 Div3模拟赛题解
    Codeforces Round #664 (Div. 2) 题解
    CSP2019回忆录
    [SHOI2014]三叉神经树(加强版)题解
    Linux 下修改Swap区设置
    LoadRunner监控Linux与Windows方法
  • 原文地址:https://www.cnblogs.com/hllive/p/7068765.html
Copyright © 2011-2022 走看看