我的目标是在新窗口中在 IE8 中启动一些页面。我正在使用 _target = blank ,但结果窗口的开始六是像 300X400。所以,我的问题是:如果我使用 _target = black,我是否能够管理浏览器结果窗口的大小?
更新:如果可能的话,我需要没有 js 的解决方案
我的目标是在新窗口中在 IE8 中启动一些页面。我正在使用 _target = blank ,但结果窗口的开始六是像 300X400。所以,我的问题是:如果我使用 _target = black,我是否能够管理浏览器结果窗口的大小?
更新:如果可能的话,我需要没有 js 的解决方案
尝试这样的事情:
<script type="text/javascript">
function showPopup(url) {
newwindow=window.open(url,'name','height=190,width=520,top=200,left=300,resizable');
if (window.focus) {newwindow.focus()}
}
</script>
HTML:
<a href='...' onClick='showPopup(this.href);return(false);'>Info</a>
没有 JavaScript,这是不可能的。所以,这里是代码!
<a onclick="window.open('http://www.google.com','nyWindow','width=300,Height=400');">Open Window</a>
希望它可以帮助你...
尝试这个
<a href="#" onclick="window.open('google.com','height=100,width=100');return false;">test</a>
这里是如何使用 JQuery 完成的:
<script type="text/javascript">
var windowSizeArray = [ "width=200,height=200",
"width=300,height=400,scrollbars=yes" ];
$(document).ready(function(){
$('.newWindow').click(function (event){
var url = $(this).attr("href");
var windowName = "popUp";//$(this).attr("name");
var windowSize = windowSizeArray[$(this).attr("rel")];
window.open(url, windowName, windowSize);
event.preventDefault();
});
});
</script>
<a href="http://www.Zakharko.com/" rel="0" class="newWindow" >open me</a>