473,395 Members | 1,343 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,395 software developers and data experts.

Can someone help e debug this popup window script please?

Don
Hi,

I have the following script that displays a popup window centered in the
middle of the screen. I am getting a script error in both IE and Netscape
but I don't know what it means. Thanks in advance.

The error is
------------
Error: win has no properties
Line 13 below ( win.window.focus(); )

The code is
------------
var win= null;
function newWindow(mypage,myname,w,h,scroll) {
var winl = (screen.availWidth-w)/2;
var wint = (screen.availHeight-h)/2;
var settings ='height='+h+',';
settings +='width='+w+',';
settings +='top='+wint+',';
settings +='left='+winl+',';
settings +='scrollbars='+scroll+',';
settings +='resizable=yes';
win=window.open(mypage,myname,settings);
if(parseInt(navigator.appVersion) >= 4)
win.window.focus();
if (!win.opener)
win.opener = self;
}
Jul 20 '05 #1
6 1588
Don wrote:
Hi,

I have the following script that displays a popup window centered in the
middle of the screen. I am getting a script error in both IE and Netscape
but I don't know what it means. Thanks in advance.

The error is
------------
Error: win has no properties
Line 13 below ( win.window.focus(); ) I'm no specialist but the win.window.focus() seems rather odd (to me).
Why not win.focus() (y'v got the variable).
Otherwise I'd set a breakpoint below win=... to see what has happened.

F DCG
The code is
------------
var win= null;
function newWindow(mypage,myname,w,h,scroll) {
var winl = (screen.availWidth-w)/2;
var wint = (screen.availHeight-h)/2;
var settings ='height='+h+',';
settings +='width='+w+',';
settings +='top='+wint+',';
settings +='left='+winl+',';
settings +='scrollbars='+scroll+',';
settings +='resizable=yes';
win=window.open(mypage,myname,settings);
if(parseInt(navigator.appVersion) >= 4)
win.window.focus();
if (!win.opener)
win.opener = self;
}

Jul 20 '05 #2
In article <o4*******************@news01.bloor.is.net.cable.r ogers.com>,
do********@rogers.com enlightened us with...
Hi,

I have the following script that displays a popup window centered in the
middle of the screen. I am getting a script error in both IE and Netscape
but I don't know what it means. Thanks in advance.

The error is
------------
Error: win has no properties
Line 13 below ( win.window.focus(); )
win is a window object. There is no window property of a window object,
AFAIK.
win=window.open(mypage,myname,settings);
if(parseInt(navigator.appVersion) >= 4)
win.window.focus();


win.focus() or win.document.focus()
--
--
~kaeli~
A little rudeness and disrespect can elevate a meaningless
interaction to a battle of wills and add drama to an
otherwise dull day.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #3
In article <o4*******************@news01.bloor.is.net.cable.r ogers.com>,
do********@rogers.com enlightened us with...

The error is
------------
Error: win has no properties
Line 13 below ( win.window.focus(); )
Also, you don't check for null before you try
win=window.open(mypage,myname,settings);
if(parseInt(navigator.appVersion) >= 4) {
if (win != null)
win.focus();
else alert("no window object");
}
if (!win.opener)
win.opener = self;
}


That would cause problems with popup blockers that killed the window.

--
--
~kaeli~
A little rudeness and disrespect can elevate a meaningless
interaction to a battle of wills and add drama to an
otherwise dull day.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #4
DU
Don wrote:
Hi,

I have the following script that displays a popup window centered in the
middle of the screen. I am getting a script error in both IE and Netscape
but I don't know what it means. Thanks in advance.

The error is
------------
Error: win has no properties
Line 13 below ( win.window.focus(); )

This message might refer to an asynchronuous state of the window and its
object reference. The win variable might not be created in the stack
while you're trying to access its properties.
The code is
------------
var win= null;
function newWindow(mypage,myname,w,h,scroll) {
var winl = (screen.availWidth-w)/2;
var wint = (screen.availHeight-h)/2;
var settings ='height='+h+',';
settings +='width='+w+',';
settings +='top='+wint+',';
settings +='left='+winl+',';
settings +='scrollbars='+scroll+',';
settings +='resizable=yes';
Scrollbars should be set to true (or 1) at all the time: scrollbar(s)
should appear when content overflows requested window dimensions,
otherwise the popup goes against normal and standard accessibility to
content.
win=window.open(mypage,myname,settings);
if(parseInt(navigator.appVersion) >= 4)
win.window.focus();
There is no point to this instruction. You are supposed to just have
created and opened a new window which will be brought on top of the
opener. Why try to bring it on top? This is redundant and unneeded.
if (!win.opener)
win.opener = self;


This instruction too should be dropped. It can only lead to problems.

DU
Jul 20 '05 #5
DU
kaeli wrote:


The error is
------------
Error: win has no properties
Line 13 below ( win.window.focus(); )

win is a window object. There is no window property of a window object,
AFAIK.


"The window property is a synonym for the current window or frame.
Property of window
Read-only (...)"
http://devedge.netscape.com/library/...w.html#1204007

DU
Jul 20 '05 #6
In article <bu**********@news.eusc.inter.net>,
dr*******@hotWIPETHISmail.com enlightened us with...

"The window property is a synonym for the current window or frame.
Property of window
Read-only (...)"
http://devedge.netscape.com/library/...w.html#1204007


Good to know.

Thanks!
--
--
~kaeli~
Dijon vu - the same mustard as before.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #7

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

Similar topics

38
by: Shaun McKinnon | last post by:
HI...Here's my problem...I have a popup window that loads when i want it to, but it's not sized properly. I've set the size, but it doesn't seem to work. I've been on 8 different websites to find...
1
by: Robert | last post by:
Simple way of writing debug print statements in your JavaScript code. You need to have enabled popups in your browser. I liked the ability to write to the java console in Netscape 4.x. This,...
12
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
26
by: Raffi | last post by:
Hi, We have a database application that runs in a popup Internet Explorer application window. The reason for this is to isolate the casual user from the address bar and the typical IE navigation...
4
by: VR | last post by:
First, greetings to everyone :) I'm doing a university seminar & I've encountered a problem. I have a gallery with thumbnails linked on pictures. What I want is popup to be opened with...
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...
3
by: Chrysan | last post by:
I have a popup window, which consist of a asp:textbox and a asp:button. And, I would like to pass the textbox.text to the javascript function when I click the button. Besides, by clicking the...
2
by: jackson2005 | last post by:
OK, I need to do three different things. On the ONLOAD event I would like a popup box to open. In this popup box I need two text boxes. One for the UserName and one for the BillingTo name. ...
3
by: K B | last post by:
I'm using 2.0 and am opening a popup window in javascript. All works fine including the Calendar popup window and the select function. When it gets to the last line which is to process the client...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.