Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mozilla Firefox problems with "parent"

Status
Not open for further replies.

c4n

Programmer
Mar 12, 2002
110
SI
Hello,

Here is the situation:

I have a page with a form named "form1". It has a textarea in it, named "comments".

<form name="form1" ...>
<textarea name="comments" ...>
...
</textarea>
...
</form>

Within the form I have a (javascript) link, that opens a new window named "smileys". Within this new window I have this function:

function insertSmiley(text) {
var space=" ";
parent.opener.form1.comments.value += space + text + space;
}

Basically what it does is inserts var text from this new (smileys) window to the "parent" window into form1 > textarea comments.

This works ok in IE, but not in Mozilla Firefox. I get this error:

parent.opener.form1 has no properties.

It points out to this line:
parent.opener.form1.comments.value += space + text + space;


NOW, is "parent.opener" only supported in IE? Any other way I can do this so it will also work in Mozilla?

Any help would be much appreachiated.

Thank you!
 
Hi again,

No problem, figured it out. I changed

parent.opener.form1.comments.value

to:

parent.opener.document.form1.comments.value

and now it works in Mozilla too.

Regards!
 

Yes - IE seems to have presented us with many "lazy" techniques of referring to elements, most of which do not work outside of IE, or for the greater good of web standards.

You are better off developing for browsers like FireFox and then making your code "backwards compatible" with IE (in the rare case that it breaks in IE).

Hope this helps,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top