Page 1 of 1

Changing text on the screen using javascript

Posted: Mon Oct 02, 2006 4:21 am
by mjseaden
Hi,

I know I can change the contents of, say, a text object dynamically by using JS DOM code such as:

Code: Select all

document.GetByElementId('mytext').value = "some text"
That's fine - the problem is I want to actually change just some plain text on the screen, instead of the value tag of an HTML object. I don't know of any object that just outputs plain HTML text onto the screen, the properties of which I can change dynamically to my bidding.

I know I can use document.write to output text, however I can't 'write over' text that's already there using this function, as far as I am aware.

What do I do to change plain HTML text content on the screen from one set of text to another without having to refresh the whole screen - is this possible?

Many thanks

Mark

Posted: Mon Oct 02, 2006 6:51 am
by Chris Corbyn

Code: Select all

document.getByElementId('myelement').innerHTML = 'my new markup';