js window.open 打开新窗体 参数设置
Posted 众里寻Ta千百度 ^_^
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了js window.open 打开新窗体 参数设置相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<form>
<input type="button" name="Button1" value="CN-Bruce" onclick="WinOpen()" />
<button onclick="window.open(\'http://www.aspxhome\', \'\', \'width=800,height=300\')">open1</button>
<button onclick="var newwin = window.open(\'http://www.aspxhome\', \'\', \'width=800,height=300\'); newwin.moveTo(50, 50), newwin.resizeTo(800, 300)">open2</button>
<button onclick="window.showModelessDialog(\'http://www.aspxhome\', \'\', \'dialogWidth:800px;dialogHeight:300px\')">open3</button>
<a href="#" onclick="window.open(\'http://www.aspxhome\',\'target\',\'param\')">a11</a>
</form>
<body>
</body>
</html>
<!--window.open 参考文档:http://www.cnblogs.com/mfryf/archive/2013/06/10/3130286.html-->
<script language="javascript">
function WinOpen() {
//得到页面高度
var yScroll = (document.documentElement.scrollHeight > document.documentElement.clientHeight) ? document.documentElement.scrollHeight : document.documentElement.clientHeight;
//self.resizeBy = yScroll;
//得到页面宽度
var xScroll = (document.documentElement.scrollWidth > document.documentElement.clientWidth) ? document.documentElement.scrollWidth : document.documentElement.scrollWidth;
//self.resizeTo(xScroll - 200, yScroll - 200);
//self.moveTo(xScroll - 200, yScroll - 200);
var x = xScroll - 200;
var y = yScroll - 100;
//mesg = open("http://www.aspxhome", "DisplayWindow", "toolbar=no,,menubar=no,location=no,scrollbars=no");
//mesg.document.write("<HEAD><TITLE>中国asp之家</TITLE></HEAD>");
//mesg.document.write("<CENTER>http://www.aspxhome</CENTER>");
//window.open(\'http://www.aspxhome\', \'\', \'width="\' + x + \'px",height="\' + y + \'"px\');
var featrures = "toolbar=no,menubar=no,location=no,scrollbars=yes,";
var newwin = window.open(\'http://www.aspxhome\', \'target\', featrures);
newwin.resizable = "yes";
newwin.moveTo(100, 10);
newwin.moveBy(100, 80);
top = 200
// newwin.resizeTo(x, y);
}
//得到页面高度
var yScroll = (document.documentElement.scrollHeight > document.documentElement.clientHeight) ? document.documentElement.scrollHeight : document.documentElement.clientHeight;
//self.resizeBy = yScroll;
//得到页面宽度
var xScroll = (document.documentElement.scrollWidth > document.documentElement.clientWidth) ? document.documentElement.scrollWidth : document.documentElement.scrollWidth;
//self.resizeTo(xScroll - 200, yScroll - 200);
//self.moveTo(xScroll - 200, yScroll - 200);
</script>
以上是关于js window.open 打开新窗体 参数设置的主要内容,如果未能解决你的问题,请参考以下文章
js window.open打开页面问题,何时打开是新的页签,何时打开是新的窗体?
Window.open 实现导航与打开窗口,导航到一个特定链接地址,也可以打开一个新的浏览器窗体
请教一个js语法:window.open()在IE中只是打开一个新页面,怎样才能在IE中打开一个新窗口?