window.open没有应用给定的高度参数 [英] window.open is not applying the given height parameter

查看:84
本文介绍了window.open没有应用给定的高度参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个onclick事件,其中window.open为一个链接执行,我也给了它的自定义宽度和高度,但不接受它,弹出窗口显示不同的宽度和高度..有人可以指导我一定有什么问题吗?

我的window.open语法如下所示:

$ pre > onclick ='var myW = window.open(http://www.google.co.jp/\",\"mywindow\",\"location=1,toolbar=1,menubar=1,resizable = 1,宽度= 846,高度= 786\" );

另外如何更改弹出窗口在屏幕上的显示位置?


注意:在所有的答复之后,我的代码都是正面的。我试过了
,并在想到它后发现,无论我在
参数的浏览器比它更多...可能是由于
的分辨率....



解决方案

您的代码工作正常:

 < html> 
< head>
< / head>
< body>
< input type =buttonvalue =clonclick ='var myW = window.open

(http://www.google.co.jp/, mywindow的, 位置= 1,工具栏= 1,菜单栏= 1,可调整大小= 1,宽度= 200,高度= 200);'>
< / body>
< / html>

更多检查: - http://www.w3schools.com/jsref/met_win_open.asp

窗口位置弹出窗口就在它打开后使用:
$ b $ pre $ window.moveTo(50,50); //你的窗口对象: -

moveTo的参数是左边位置,后面是窗口左上角的顶部位置。

I have a onclick event on a link inwhich window.open for a url is executed , I have also given the custom width and height for it, but is not accepting it and pop window is displayed with different width and height.. can someone guide me what must be wrong with that

my window.open syntax is as follows

onclick='var myW=window.open ("http://www.google.co.jp/","mywindow","location=1,toolbar=1,menubar=1,resizable=1,width=846,height=786");

Also how to change the display position of pop window in the screen?

NOTE: AFTER ALL THE REPLIES Being Positive with my code.. I tried it and found after thinking about it that whatever size I was giving in parameter the browser taking it more than that... May be thats due to resolution....

解决方案

your code is working fine :

<html>
<head>
</head>
<body>
<input type="button" value="cl" onclick='var myW=window.open 

("http://www.google.co.jp/","mywindow","location=1,toolbar=1,menubar=1,resizable=1,width=200,height=200");'>
</body>
</html>

for more check this:- http://www.w3schools.com/jsref/met_win_open.asp
to window position a pop up window just after it opens use:-

window.moveTo(50,50);//your window object:-

The parameters for the moveTo are the left position followed by the top position for the top left corner of the window.

这篇关于window.open没有应用给定的高度参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆