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

Netscape DOM issue?

I want to use a pop-up dialog for my intranet, but I'm missing
something that keeps me from getting along with NS's browsers right
now.

I get an error to the effect of "opener.formName has no properties"

The following JS is its own file included in caller.html and
callee.html with this syntax <SCRIPT language="JavaScript"
src="pops.js"></SCRIPT>

It works in current IE's on multiple platforms and in Apple's Safari.
Any ideas about how I might work it for NS?

Thanks,

Mark

// <pops.js>

var DEBUGGING=false;
var myTarget=null;

function popUp(argURL, argOBJ, argH, argW) {
/* Useage example from caller.html:
<FORM name="stockForm">
<INPUT name="txtA" type="text" id="txtA" value="" size="10" />
<INPUT name="btnA" type="button" id="btnA"
onClick="popUp('callee.html', this)" value="." /><BR />
</FORM>
*/
try {
// default to 300x300, otherwise use options offered
argH=(!argH || argH==0) ? 300 : argH;
argW=(!argW || argW==0) ? 300 : argW;
// establish error message in case something goes wrong
var Err = new Error();
Err.message="mcs.js popUp(" + argURL + ", " + argOBJ.name + ", " +
argH + ", " + argW + ") error:\n\nmyTarget not established or window
not opened";
// set aside the name of the object which will be receiving the
value chosen in the popUp window
// presumes usage from naming as used above txtA and btnA
myTarget=argOBJ.form.name+'.'+'txt'+argOBJ.name.su bstr(3,
argOBJ.name.length-3);
if (DEBUGGING) alert('myTarget='+myTarget);
// open the popUp
listWin=window.open(argURL, 'list', 'height='+argH+',
width='+argW+', left =100, top=100, location=no, menubar=no,
resizable=yes, scrollbars=yes, status=no, toolbar=no');
// complain if it didn't work
if (myTarget==null || !listWin) throw(Err);
}
catch (Err)
{ alert(Err.message); }
}

function popDown(argVAL) {
/* Useage example from callee.html:
<A href="#" onClick="popDown('AMZN')">AMZN</A>
*/
try {
// establish error message in case something goes wrong
var Err = new Error();
Err.message="mcs.js popDown("+argVAL+") error:\n\nmyTarget not set";
var evalMe="opener."+opener.myTarget+".value="+"'"+arg VAL+"'";
if (DEBUGGING) alert('evalMe='+evalMe);
eval(evalMe);
// if myTarget != val then complain
if (eval("opener."+opener.myTarget+".value!="+"'"+arg VAL+"'"))
throw(Err);
else window.close();
}
catch (Err)
{ alert(Err.message); }
}

// </pops.js>
Jul 20 '05 #1
2 2061
DU
Mark Stafford wrote:
I want to use a pop-up dialog for my intranet, but I'm missing
something that keeps me from getting along with NS's browsers right
now.

I get an error to the effect of "opener.formName has no properties"
opener is a window object reference. formName is a form name attribute.
You need the document node in between. So:

opener.document.formName should reference appropriately the form.

The following JS is its own file included in caller.html and
callee.html with this syntax <SCRIPT language="JavaScript"
src="pops.js"></SCRIPT>
Validate your markup. Doing so will avoid lots of errors, problems,
cross-browser issues, etc... Here, language is a deprecated attribute.
type has superseded language and is both backward and forward compatible. So

<script type="text/javascript" src="pops.js"></script>

It works in current IE's on multiple platforms and in Apple's Safari.
Any ideas about how I might work it for NS?

Thanks,

Mark

// <pops.js>

var DEBUGGING=false;
var myTarget=null;

function popUp(argURL, argOBJ, argH, argW) {
/* Useage example from caller.html:
<FORM name="stockForm">
The form element requires an action attribute.
<INPUT name="txtA" type="text" id="txtA" value="" size="10" />
I do not recommend giving the same name attribute value and same id
attribute value to elements. Giving the same name and id attribute do
not contribute to code readability, ease of debugging, reviewing by
others, use of debugger softwares.
<INPUT name="btnA" type="button" id="btnA"
onClick="popUp('callee.html', this)" value="." /><BR />
</FORM>
If this is an xhtml file, then you need to lowercase your element's tags.
*/
try {
// default to 300x300, otherwise use options offered
argH=(!argH || argH==0) ? 300 : argH;
argW=(!argW || argW==0) ? 300 : argW;
// establish error message in case something goes wrong
var Err = new Error();
I wonder anyway why you do not just use the javascript console and
Venkman javascript debugger here.
The error object is generated in the catch block as an argument; so no
need to create an Error() object.

Err.message="mcs.js popUp(" + argURL + ", " + argOBJ.name + ", " +
argH + ", " + argW + ") error:\n\nmyTarget not established or window
not opened";
// set aside the name of the object which will be receiving the
value chosen in the popUp window
// presumes usage from naming as used above txtA and btnA
myTarget=argOBJ.form.name+'.'+'txt'+argOBJ.name.su bstr(3,
argOBJ.name.length-3);
if (DEBUGGING) alert('myTarget='+myTarget);
// open the popUp
listWin=window.open(argURL, 'list', 'height='+argH+',
width='+argW+', left =100, top=100, location=no, menubar=no,
resizable=yes, scrollbars=yes, status=no, toolbar=no');
Avoid blank space in the 3rd parameter (arguments string list).
"windowFeatures is an optional string containing a comma-separated list
of options for the new window (do not include any spaces in this list)."
http://devedge.netscape.com/library/...w.html#1202731

You can trim and compact all this by remembering that as soon as you
mention 1 argument in the 3rd parameter, then all other windowFeatures
are turned off.
"if you do supply the windowFeatures parameter, then the titlebar and
hotkeys are still yes by default, but the other features which have a
yes/no choice are no by default."
http://devedge.netscape.com/library/...w.html#1202731
This is also the case for MSIE.
So:

listWin=window.open(argURL, 'list', 'height='+argH+',
width='+argW+',left=100,top=100,resizable=yes,scro llbars=yes');

will work in NS 6.2+.

// complain if it didn't work
if (myTarget==null || !listWin) throw(Err);
}
catch (Err)
{ alert(Err.message); }
}

function popDown(argVAL) {
/* Useage example from callee.html:
<A href="#" onClick="popDown('AMZN')">AMZN</A>
*/
try {
// establish error message in case something goes wrong
var Err = new Error();
Err.message="mcs.js popDown("+argVAL+") error:\n\nmyTarget not set";
The error object should not be processed in the try block but rather
created and processed in the catch block.
Error handling in JavaScript 1.5:
http://webbuilder.netscape.com/webbu...5461505-1.html
var evalMe="opener."+opener.myTarget+".value="+"'"+arg VAL+"'";
Around here, your code gets complicated. It would be a lot more easier
to figure out with an url (online html file)... That's always better.
if (DEBUGGING) alert('evalMe='+evalMe);
eval(evalMe);
Avoid eval calls everywhere in all your script functions. There is now a
solid consensus among regulars of this newsgroup that eval() calls are
always inferior to more specific methods or attributes.
// if myTarget != val then complain
if (eval("opener."+opener.myTarget+".value!="+"'"+arg VAL+"'"))
throw(Err);
else window.close();
}
catch (Err)
{ alert(Err.message); }
}

// </pops.js>


DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #2
> opener is a window object reference. formName is a form name attribute.
You need the document node in between. So:

opener.document.formName should reference appropriately the form.


That did the trick. Thank you for that and the additional pointers.
Jul 20 '05 #3

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

Similar topics

4
by: Yvan J. Gagnon | last post by:
I am encountering a strange problem in Netscape 7 with a CFM file I am trying to troubleshoot (the page is working fine in NS Communicator and IE). Below is a sample of the problematic line of...
9
by: rez | last post by:
I find it rather frustrating that Netscape 4.x is "no longer supported:" http://help.netscape.com/products/client/communicator/reflib.html Same seems true with IE. How am I ever supposed to...
13
by: Gaurav | last post by:
Hello, i have some java script with in html. It runs fine on IE 6.0 but doesnt run on netscape 7.1 Can someone tell me whats the problem ? And how can i solve it. here is the url ...
11
by: Jonny | last post by:
Netscape 7.02 is giving me a headache with a downloaded snow script. Starting with a blank page, I inserted the script and checked it in IE 6 and Netscape 7.02. Everything worked and looked fine. A...
2
by: Joy | last post by:
Hi, I recently created a website in ASP.NET and it looks great in IE but in Netscape there is a strange dark blue background behind all the asp:tables. Since I set the background for these tables...
18
by: Dennis | last post by:
It seems that garbage collection is somewhat flawed in Netscape as the following little script can bring a machine to its knees in about an hour when run on Netstcape 7.1. I've tried freeing the...
5
by: zaw | last post by:
Hi I am working on implementing this script to shopping cart. Basically, it copies fill the shipping address from billing automatically. I believe one or more syntax is not netscape compatible....
6
by: christian9997 | last post by:
Hi I would be very helpful if someone could help me with this code. It works fine in IE but when I display it in Netscape or Firefox and I move the mouse from one menu to the other the gap...
13
by: M B HONG 20 | last post by:
Hi all - I have a .NET web service running on a remote machine, and I have Netscape Navigator 7.0 accessing it through javascript on the client side through SOAP javascript coding. Everything...
7
by: David Laub | last post by:
I have stumbled across various Netscape issues, none of which appear to be solvable by tweaking the clientTarget or targetSchema properties. At this point, I'm not even interested in "solving"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.