zoukankan      html  css  js  c++  java
  • 设置window.open窗口页面title

    index.html---------------------------------------------------------------

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>window.open</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    </head>
    <body>
    <button id="btn" type="button">按钮打开window.open</button>
    </body>
    </html>
    <script type="text/javascript">
    $(function(){
    $("#btn").click(function(){
    // 设置open页面title
    var setOpenTile = "设置title"
    // 设置窗口宽度
    var iwidth = 1200
    // 设置窗口高度
    var iheight = 600
    //获得窗口的垂直位置
    var iTop = (window.screen.availHeight - 30 - iheight) / 2;
    //获得窗口的水平位置
    var iLeft = (window.screen.availWidth - 10 - iwidth) / 2;
    window.open("open.html","setTitle","height="+iheight+", width="+iwidth+",top="+iTop+",left="+iLeft+",toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,resizable=no,status=no");
    // 定义全局变量给open页面调用
    window.getTitleFun = setOpenTile
    })
    })
    </script>

    open.html---------------------------------------------------------------

    <!DOCTYPE html>
    <html lang="zh">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>openTitle</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    </head>
    <body>
    <button type="button" >确定</button>
    </body>
    </html>
    <script type="text/javascript">
    window.onload=function(){
    if (window.opener != null) {
    document.title = window.opener.getTitleFun;
    }
    }
    </script>

  • 相关阅读:
    Ubuntu在用root账户使用xftp连接时提示拒绝连接
    Ubuntu设置root账户密码
    Ubuntu安装Nginx
    Ubuntu不能上网解决办法
    Ubuntu16.04修改静态ip地址
    Ubuntu下vi编辑器不听话
    thinkpad t420安装debian需要注意的细节
    debian7配置iptables
    debian的甘特图工具
    debian修改ssh端口
  • 原文地址:https://www.cnblogs.com/onceweb/p/13861826.html
Copyright © 2011-2022 走看看