Click to See Complete Forum and Search --> : innerHTML in NS4.x


garron
03-18-2003, 02:48 AM
Hi,

I wrote a “highlight keyword” function in JavaScript where I use the innerHtml property to get the body content into a variable. The script works fine with IE 4.x and NS 7, but NS 4.x doesn’t support this property.

Does anybody know an equivalent property that works in NS 4.x. ?

Thanks for help.

Christian
:confused:

khalidali63
03-18-2003, 06:14 AM
not a very easy solution..
If I remember it correctly it used to be

first get the reference to that object,say you have a div tag id=id_1
var obj = document.layers["id_1"];
then do this
obj.document.write.open();
obj.document.write.write(value);
obj.document.write.close();

This is if I remember correctly..
It has been a while that I coded n e thing ns 4+ compliant.

:D

Cheers

Khalid

gil davis
03-18-2003, 06:28 AM
There is none.

There is a method called getSelection() that returns whatever the user has highlighted.

You can retreive the text of an anchor.<a href="#" onclick="alert(this.text)">This is some text</a>

There is a method called find() that will search the document for a string and highlight it's occurrence.