/    Sign up×
Community /Pin to ProfileBookmark

innerHTML in NS4.x

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
?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@khalidali63Mar 18.2003 — 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.

?

Cheers

Khalid
Copy linkTweet thisAlerts:
@gil_davisMar 18.2003 — 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.
×

Success!

Help @garron spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...