Changing text on the screen using javascript

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Changing text on the screen using javascript

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Code: Select all

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