window.open / resizeTo问题 [英] window.open / resizeTo problem

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

问题描述

以下代码打开一个新窗口,但是resizeTo和没有调整大小。

为什么不呢?


(不要问我为什么不打开新尺寸的窗户.. ..my

原始问题是如何打开一个尺寸最大化的新窗口!)


仅供参考我将相同的代码上传到:
http://tosasoft.com/test/open.htm


======================================== br />

< html>

< head>

< SCRIPT LANGUAGE =" JavaScript"><! - -


函数pgppopup(){

winobj1 = window.open('''http://www.yahoo.com/'',''mywin1 '',

''top = 0,left = 0,height = 120,width = 120,''+

''toolbar = yes,menubar = yes, scrollbars = yes,''+

''resizable = yes,location = yes,status = yes'');

winobj1.resizeTo(600,400);

}


// - >< / SCRIPT>


< / head>

< body>

< SCRIPT LANGUAGE =" JavaScript"><! -


window.onload = pgppopup;


// - >< / SCRIPT>


< h1>测试到打开并调整大小< / h1>


< / body>

< / html>


= =======================================

解决方案

David McCulloch说:

以下代码打开一个新窗口,但是resizeTo没有调整大小。
为什么不呢?

...




您使用的浏览器是什么?有些浏览器允许你控制脚本是否可以打开/调整大小/移动/最小化/最大化窗口 - 比如Opera ;-)。




Mike Foster < MI ******** @ mfosternospam.com>在消息中写道

news:op ************** @ news.charter.net ...

David McCulloch说:< blockquote class =post_quotes>以下代码打开一个新窗口,但是resizeTo它没有调整大小
。为什么不呢?

...



您使用的浏览器是什么?有些浏览器允许你控制是否或



脚本不能打开/调整大小/移动/最小化/最大化窗口 - 比如Opera ;-)。


我正在寻找通用代码。尽可能地,我希望与今天最常用的浏览器兼容

(IE6 +,NS6 / 7,Opera

6/7等) 。


我在Windows XP下在IE6上测试了这段代码并遇到了问题。任何

想法可能是什么问题?当您在我的网址上点击

时,您是否遇到同样的问题?窗口打开的窗口应该是600x400,而不是卡在

120x120。
http://tosasoft.com/test/open.htm


" David McCulloch" < | @ | |>在消息中写道

新闻:Vd ****************** @ twister.rdc-kc.rr.com ...


Mike Foster < MI ******** @ mfosternospam.com>在消息中写道
新闻:op ************** @ news.charter.net ...

David McCulloch说:

以下代码打开一个新窗口,但是resizeTo不会


调整大小

它。为什么不呢?

...
您使用的浏览器是什么?有些浏览器允许你控制



或者脚本是否可以打开/调整大小/移动/最小化/最大化窗口 - 比如Opera
; - )。 Opera 6/7等)。
我在Windows XP下在IE6上测试了这段代码并遇到了问题。
知道问题是什么吗?当你点击我的网址时,你有同样的问题吗?窗口打开的窗口应为600x400,而不是在120x120处停留

http://tosasoft.com/test/open.htm




这在我的一台计算机上无声地失败,并显示:

"第9行出错,winobj1为空或不是对象

在另一个对象上,我打开了脚本调试。


当然,因​​为我正在使用Google的PopUp Blocker。


-

Dag

58°26''15.9" N 008°46''45.5 E


The following code opens a new window, but the "resizeTo" doesn''t resize it.
Why not?

(Don''t ask why I simply did not open the window with the new size....my
original problem was how to open a new window with maximized dimensions!)

FYI, I uploaded the same code to:
http://tosasoft.com/test/open.htm

========================================

<html>
<head>
<SCRIPT LANGUAGE="JavaScript"><!--

function pgppopup() {
winobj1 = window.open(''http://www.yahoo.com/'', ''mywin1'',
''top=0,left=0,height=120,width=120,'' +
''toolbar=yes,menubar=yes,scrollbars=yes,'' +
''resizable=yes,location=yes,status=yes'');
winobj1.resizeTo(600,400);
}

//--></SCRIPT>

</head>
<body>
<SCRIPT LANGUAGE="JavaScript"><!--

window.onload = pgppopup;

//--></SCRIPT>

<h1>Test to Open and Resize</h1>

</body>
</html>

========================================

解决方案

David McCulloch said:

The following code opens a new window, but the "resizeTo" doesn''t resize it.
Why not?

...



What browser are you using? Some browsers allow you to control whether or not scripts can open/resize/move/minimize/maximize windows - like Opera ;-).



"Mike Foster" <mi********@mfosternospam.com> wrote in message
news:op**************@news.charter.net...

David McCulloch said:

The following code opens a new window, but the "resizeTo" doesn''t resize it. Why not?

...



What browser are you using? Some browsers allow you to control whether or


not scripts can open/resize/move/minimize/maximize windows - like Opera ;-).

I am looking for generic code. As much as possible, I would like to be
compatible with the browsers most commonly in use today (IE6+, NS6/7, Opera
6/7, etc.).

I tested this code on IE6 under Windows XP and encountered the problem. Any
idea what the problem could be? Do you have the same problem when you click
on my web address? The window open''d window should be 600x400, not stuck at
120x120.
http://tosasoft.com/test/open.htm


"David McCulloch" <|@|.|> wrote in message
news:Vd******************@twister.rdc-kc.rr.com...


"Mike Foster" <mi********@mfosternospam.com> wrote in message
news:op**************@news.charter.net...

David McCulloch said:

The following code opens a new window, but the "resizeTo" doesn''t

resize

it. Why not?

...
What browser are you using? Some browsers allow you to control whether


or not scripts can open/resize/move/minimize/maximize windows - like Opera ;-).
I am looking for generic code. As much as possible, I would like to be
compatible with the browsers most commonly in use today (IE6+, NS6/7, Opera 6/7, etc.).

I tested this code on IE6 under Windows XP and encountered the problem. Any idea what the problem could be? Do you have the same problem when you click on my web address? The window open''d window should be 600x400, not stuck at 120x120.
http://tosasoft.com/test/open.htm



This fails silently on one of my computers, and shows:
"Error on Line 9, winobj1 is null or not an object"
on another, where I have script-debugging turned on.

Both of course because I''m using Google''s PopUp Blocker.

--
Dag
58°26''15.9" N 008°46''45.5" E


这篇关于window.open / resizeTo问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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