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

How to have a variable text on a webpage

P: n/a
Today I display a placeholder '.' on my webpage with
<h3 id = "MyPlaceholder">.</h3>

Later in my JavaScript I change the placeholder '.' to something else (e.g.
'My new text')
document.getElementById("MyPlaceholder").firstChil d.replaceData(0,
document.getElementById("MyPlaceholder").firstChil d.nodeValue.length, "My
new text");

In general this works great. But the command replaceData() does not exist in
IE 5.5.
Is there any other possibility to do what I'd like to do?

Stefan
Nov 24 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Stefan Mueller wrote on 24 nov 2005 in comp.lang.javascript:
Today I display a placeholder '.' on my webpage with
<h3 id = "MyPlaceholder">.</h3>

Later in my JavaScript I change the placeholder '.' to something else
(e.g. 'My new text')
document.getElementById("MyPlaceholder").firstChil d.replaceData(0,
document.getElementById("MyPlaceholder").firstChil d.nodeValue.length,
"My new text");

In general this works great. But the command replaceData() does not
exist in IE 5.5.
Is there any other possibility to do what I'd like to do?


just put it there:

<div id = 'MyPlaceholder'>Old Text.</div>

................

document.getElementById('MyPlaceholder').innerHTML =
'My new text.';
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Nov 24 '05 #2

P: n/a
> just put it there:

<div id = 'MyPlaceholder'>Old Text.</div>

...............

document.getElementById('MyPlaceholder').innerHTML =
'My new text.';


Great, that's works on every browser and it's even much less complicated
than my try.

Many thanks
Stefan
Nov 24 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.