473,760 Members | 9,717 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.focu s(); )

The code is
------------
var win= null;
function newWindow(mypag e,myname,w,h,sc roll) {
var winl = (screen.availWi dth-w)/2;
var wint = (screen.availHe ight-h)/2;
var settings ='height='+h+', ';
settings +='width='+w+', ';
settings +='top='+wint+' ,';
settings +='left='+winl+ ',';
settings +='scrollbars=' +scroll+',';
settings +='resizable=ye s';
win=window.open (mypage,myname, settings);
if(parseInt(nav igator.appVersi on) >= 4)
win.window.focu s();
if (!win.opener)
win.opener = self;
}
Jul 20 '05 #1
6 1610
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.focu s(); ) I'm no specialist but the win.window.focu s() 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(mypag e,myname,w,h,sc roll) {
var winl = (screen.availWi dth-w)/2;
var wint = (screen.availHe ight-h)/2;
var settings ='height='+h+', ';
settings +='width='+w+', ';
settings +='top='+wint+' ,';
settings +='left='+winl+ ',';
settings +='scrollbars=' +scroll+',';
settings +='resizable=ye s';
win=window.open (mypage,myname, settings);
if(parseInt(nav igator.appVersi on) >= 4)
win.window.focu s();
if (!win.opener)
win.opener = self;
}

Jul 20 '05 #2
In article <o4************ *******@news01. bloor.is.net.ca ble.rogers.com> ,
do********@roge rs.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.focu s(); )
win is a window object. There is no window property of a window object,
AFAIK.
win=window.open (mypage,myname, settings);
if(parseInt(nav igator.appVersi on) >= 4)
win.window.focu s();


win.focus() or win.document.fo cus()
--
--
~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.ca ble.rogers.com> ,
do********@roge rs.com enlightened us with...

The error is
------------
Error: win has no properties
Line 13 below ( win.window.focu s(); )
Also, you don't check for null before you try
win=window.open (mypage,myname, settings);
if(parseInt(nav igator.appVersi on) >= 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.focu s(); )

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(mypag e,myname,w,h,sc roll) {
var winl = (screen.availWi dth-w)/2;
var wint = (screen.availHe ight-h)/2;
var settings ='height='+h+', ';
settings +='width='+w+', ';
settings +='top='+wint+' ,';
settings +='left='+winl+ ',';
settings +='scrollbars=' +scroll+',';
settings +='resizable=ye s';
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(nav igator.appVersi on) >= 4)
win.window.focu s();
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.focu s(); )

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**********@n ews.eusc.inter. net>,
dr*******@hotWI PETHISmail.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
5089
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 out what i'm doing wrong, and so far it seems i'm doing it the right way. Here's my code...any suggestions would be appreciated. <script language="javascript"> <!-- window.open("256fx/index.htm", "", "height=400, width=600"); //-->
1
2082
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, ability is missing in IE and the latest versions of Netscape. Maybe someone knows a better way and can improve on this code, the following JavaScript code demonstrates how to write debug statements in a JavaScript program. I sure lots of people...
12
12432
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, 'height=200,width=400,status=no,toolbar=no, menubar=no,location=no resizable=no scrollable=no'); but I can't seem to invoke the client side script from within a Server Side Form. I know I can use the context with to Response.redirect or Server.transfer to return a
26
6823
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 buttons. The application has a browser test page that displays an error message when a popup blocker is found and opens a popup page stating the test was successfull if there is no popup blocker.
4
2433
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 dimensions of linked picture after clicking on a thumbnail. I found javascript which is compatible with IE, Firefox & Opera but I can't get it to work. All I get is this http://www.justfonts.com/tini/problem.html (thumbnail dissapeared).
1
11581
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 http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
3
1669
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 button, also close the popup window. The problem is, when I click the button, the textbox.text is successfully pass to the javascript function and the popup window will be closed, but the popup window will be opened again in maximize mode. I notice...
2
6957
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. After entering these two items the user can either hit the enter key or press the submit button. The popup window will close and then those two text boxes in the original webpage will be filled in automatically. I would like to have the two...
3
1299
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 script to return the value to the window.opener it just keeps the popup window open. I tried testing it by just making the <script>window.close();</script> which worked fine. The script (with value at runtime)is: ...
0
9521
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9333
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10107
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9945
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8768
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5361
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3863
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.