Javascript that does not work in NN/Mozilla

R

rnd

Hi all!

could you kindly help me to solve a compatibility problem that involves
Internet Explorer and NN/Mozilla.

I created a html page that contains a form (its name is "Modulo") and some
text boxes. After clicking on a button, a popup appears.
I tried to modify the text of "Testo" textbox from the popup windows by
using the following javascript code:
window.opener.Modulo.Testo.value=window.opener.Modulo.Testo.value + " This
will be added to Testo textbox!";

The code is correctly run by Internet Explorer and the "Testo" textbox in
the calling html page is successfully updated.
When I try to open these pages with Mozilla, the javascript code that should
update the textbox is ignored. How can I solve this problem?

I hope that someone of you will be so kind to give me an answer.

P.S. Please excuse me for my horrible English.

Best regards to all the newsgroup.
Mauro. --
 
L

Lasse Reichstein Nielsen

rnd said:
window.opener.Modulo.Testo.value=window.opener.Modulo.Testo.value + " This
will be added to Testo textbox!";

The code is correctly run by Internet Explorer

I'll accept that it works, but I'll withhold the "correctly". There is
no reason for this code to work in any browser. It works in IE, but fails
in most other browsers.

The problem is the
window.opener.Modulo
part. It accesses the Modulo form as a property of the global (window)
object of the opener. Only IE makes named forms available as global
variables. A version that is compatible with IE, Mozilla and the W3C DOM
is

window.opener.document.forms['Modulo'].elements['Testo'] +=
" This will be added to Testo textbox!";

This even works in Netscape 3 (Netscape 2 has no "opener" property).
P.S. Please excuse me for my horrible English.

It's fine. I've seen much worse from allegedly native (US-)English
speakers

/L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,077
Messages
2,570,567
Members
47,203
Latest member
EmmaSwank1

Latest Threads

Top