Forums

This topic is locked

InnerHTML in netscape

Posted 05 Apr 2001 12:21:10
1
has voted
05 Apr 2001 12:21:10 Michael van Kan posted:
Hi,
I have the following question.
I want to read the HTML-code of an page (in javascript).
In IE I put an <LABEL name="lbl"> and at the end an </LABEL>
Now in IE I can read the HTMLcode between the label(s) (after the page is loaded) with the following line of code:
var tekst = document.all["lbl"].innerHTML;

This is not working in Netscape. Is the a way to read HTMLcode in Netscape (with Javascript).

I hope someone can help me,

Michael van Kan

Replies

Replied 05 Apr 2001 19:38:12
05 Apr 2001 19:38:12 Waldo Smeets replied:
I think for NS4 it's:

document.layers["lbl"].document.write("myText";document.layers["lbl"].document.close();

Let me know when it's not correct.

Netscape 6 (and other DOM browsers):

document.getElementById("lbl".replaceChild(document.createTextNode("myText",document.getElementById("lbl".childNodes[0])

See more of these cool scripts at www.bratta.com

Waldo Smeets - www.UDzone.com Webmaster
------------------------------------------
www.UDzone.com : A Dreamweaver, Ultradev and Fireworks recourse site for developers
by developers.
------------------------------------------

Reply to this topic