473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

new window

Den
Hi, I have one simple question:
Code:
------------
<html>
<body>
<input type="button" onclick="openWindow('http://www.google.com', 'Google')"
value="Google">
</body>
<script language="JavaScript">
function openWindow(adress,name, height, width) {
window.open(adress,name,"height="+height+", width="+width);
}
</script>
</html>
------------

This is the most simple new-window script. But I discovered something:

In IE6:
When page is uploaded on webserver, script is opening one very small window
(c. 120x160) after the click on gooogle button. That is logical, as there
is no 'height' and 'width' values. But when I run this page from my desktop,
it opens one big c. 1024x768 window (my monitor resolution is 1280x1024).

Why is that?

Firefox opens the same size window in both cases (c. 900x1000). Netscape
opens identical windows too, just smaller (c. 120x130).

Den
Aug 20 '05 #1
5 1447
Lee
Den said:

Hi, I have one simple question:
Code:
------------
<html>
<body>
<input type="button" onclick="openWindow('http://www.google.com', 'Google')"
value="Google">
</body>
<script language="JavaScript">
function openWindow(adress,name, height, width) {
window.open(adress,name,"height="+height+", width="+width);


You're passing four arguments to a function that expects three,
and the syntax of the third argument is wrong (since the "height"
variable is not passed a value. It's not surprising that browsers
do unexpected things, or that they don't all do the same thing.

Aug 20 '05 #2
Guy


Den a écrit:
Hi, I have one simple question:
Code:
------------
<html>
<body>
<input type="button" onclick="openWindow('http://www.google.com', 'Google')"
value="Google">
</body>
<script language="JavaScript">
function openWindow(adress,name, height, width) {
window.open(adress,name,"height="+height+", width="+width);
window.open(adress,name,'"height='+height+', width='+width +'"');

sample :

window.open(adress,name,"toolbar=no,scrollbars=yes ,resizable=yes,
height=550, width=850")

Guy }
</script>
</html>
------------

This is the most simple new-window script. But I discovered something:

In IE6:
When page is uploaded on webserver, script is opening one very small window
(c. 120x160) after the click on gooogle button. That is logical, as there
is no 'height' and 'width' values. But when I run this page from my desktop,
it opens one big c. 1024x768 window (my monitor resolution is 1280x1024).

Why is that?

Firefox opens the same size window in both cases (c. 900x1000). Netscape
opens identical windows too, just smaller (c. 120x130).

Den


Aug 20 '05 #3
Lee wrote:
Den said:
Hi, I have one simple question:
Code:
------------
<html>
<body>
<input type="button" onclick="openWindow('http://www.google.com', 'Google')"
value="Google">
</body>
<script language="JavaScript">
function openWindow(adress,name, height, width) {
window.open(adress,name,"height="+height+", width="+width);


window.open(adress,name,"height="+height+",width=" +width);

Mick

You're passing four arguments to a function that expects three,
and the syntax of the third argument is wrong (since the "height"
variable is not passed a value. It's not surprising that browsers
do unexpected things, or that they don't all do the same thing.

Aug 20 '05 #4
Guy a écrit :


Den a écrit:
Hi, I have one simple question:
Code:
------------
<html>
<body>
<input type="button" onclick="openWindow('http://www.google.com',
'Google')" value="Google">
</body>
<script language="JavaScript">
It should be <script type="text/javascript">

var WindowObjectReference = null;
// global variable declaration and initialisation
function openWindow(adress,name, height, width) {
window.open(adress,name,"height="+height+", width="+width);


window.open(adress,name,"height="+height+", width="+width);
-------------------------------------------^

There should not be any blank space in the 3rd parameter (windowFeatures
string list).

window.open(adress,name,'"height='+height+', width='+width +'"');

sample :

window.open(adress,name,"toolbar=no,scrollbars=yes ,resizable=yes,
height=550, width=850")

Guy


WindowObjectReference = window.open(adress, name,
"scrollbars=yes,resizable=yes,height=550,width=850 ");

1- no blank space in the 3rd parameter, in the windowFeatures string list
2- With height=550,width=850 values, users with a 800x600 will have the
secondary window resize automatically in Mozilla-based browsers and in
MSIE 6 SP2 due to error correction mechanism ensuring that the whole
window is rendered in the available space of the screen.
3- Storing the return value of the window.open() call is often useful.

DOM:window.open()
Best practices
http://developer.mozilla.org/en/docs...Best_practices

Gérard
Aug 21 '05 #5
Den
Thanks for answers :)

Den
Aug 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Carol Lyn | last post by:
Could use your assistance with this. I have a window that opens via onclick and it is a small window with info about a site. If the user is interested in visiting that site, there is a link to...
2
by: Juan Garcia | last post by:
Subject says it all. Given: Window A with text field. Window B with a button (onClick opens Window C) Window C with a button (onClick I want it to modify text fields of Window A) I have...
6
by: David Hayes | last post by:
juglesh <juglesh@nospamRadioKDUG.com> wrote in "Re: how to maximize the browser window that fits the monitor size?" (Saturday, January 01, 2005 3:12 AM): > > >I want to maximize the browser...
19
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). ...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
4
by: alexandre.brisebois | last post by:
Hi, I am using access 2003, I would like to know if there is an option to reorganize the tables in a maner that is readable, as we can do in sql sever 2000 or 2005. I have been given a database...
5
by: asadhkhan | last post by:
I have the following code which works correctly in IE 6, but in IE 7, Fire Fox 2.0 and Netscape 8 it does not work. I have a main page where a button calls this pop-up and uploads a file once you...
24
by: Jeremy J Starcher | last post by:
While reading c.l.j, I've noticed that some people prefer and indeed even recommend the use of "window.alert()" over "alert()". I can't find any technical reason to make this distinction, and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.