设置window.open窗口页面title
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
设置window.open窗⼝页⾯title
index.html---------------------------------------------------------------
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>window.open</title>
<script src="https:///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:///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>。