By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,837 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

DIV element in firefox

P: n/a
I have a Rich text editor which is a DIV element. I am not able to
capture the value of this element.i am working in firefox browser.

alert(window._content.document.getElementById("RTE Content"));
This alert message gives "null".

The DIV element is declared in a IFRAME.
Have i missed somthing in referring to the div element? Help me.

Jan 10 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
I might well be wrong, but from my (limited) experience dealing with
DIVs (and other elements for that matter) -
alert(document.getElementById("RTEContent").value) should work.
Provided you replace the ".value" property with whatever it is you are
trying to access.

I am sure I am wrong, there's no way it could be that simple...

Jan 10 '06 #2

P: n/a


tweety wrote:
I have a Rich text editor which is a DIV element. I am not able to
capture the value of this element.i am working in firefox browser.
Mozilla only supports editable iframes where the designMode property is
set to on. It is not possible to have only a single div that is editable.
alert(window._content.document.getElementById("RTE Content"));
This alert message gives "null".

The DIV element is declared in a IFRAME.


Give that frame a name attribute e.g.
<iframe name="iframeName"
then you can script e.g.
var iframe = window.frames.iframeName;
if (iframe && iframe.document && iframe.document.getElementById) {
var div = iframe.document.getElementById('RTEContent');
if (div) {
// now use div here
}
}

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 10 '06 #3

P: n/a
>The DIV element is declared in a IFRAME.
Have i missed somthing in referring to the div element? Help me.


I might be totally wrong, but with windows other than the main one, you
have to either access by the array or by name. While I think firefox
allows for getElementById(); method, you should use window.frames[]
instead so you can also support Internet Explorer.

Name your div RTEContent like you did with Id

Then if you use alert(window.frames['RTEContent']);
you should get a referance to the iframe.

Jan 10 '06 #4

P: n/a
The problem is with XPCNativeWrapper. In the alert statement the object
is displayed as object XPCNativewrapper[object HtmlDivElement]

In the chrome the XPCNativeWrapper=yes by default for Firefox 1.5

How do i over write this to XPCNativewrapper=no?

Is there a solution that could be used in the javascript code to
access the dom objects?
does this always happen with iframe?

I referreed to the documentation in mozilla site and tried out
explicit XPCNativewrapper
but does not work.

Jan 12 '06 #5

P: n/a
The problem is with XPCNativeWrapper. In the alert statement the object
is displayed as object XPCNativewrapper[object HtmlDivElement]

In the chrome the XPCNativeWrapper=yes by default for Firefox 1.5

How do i over write this to XPCNativewrapper=no?

Is there a solution that could be used in the javascript code to
access the dom objects?
does this always happen with iframe?

I referreed to the documentation in mozilla site and tried out
explicit XPCNativewrapper
but does not work.

Jan 12 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.