PDA

View Full Version : How can I change the value of a div element via JS?


rpieszak
03-07-2002, 08:32 AM
This won't work:
document.all.myDiv.value=myValue

Nor will this:
document.getElmentById('myDiv').value=myValue

What attribute can I use?

Dr. Web
03-07-2002, 11:22 AM
I am also trying to set the value of the div bgcolor with these methods to no avail..... anyone?

Jon Hanlon
03-07-2002, 03:49 PM
IE5 & NS6:
document.getElementById('myDiv').innerHTML = "<b>Hello</b>"

IE4 & IE5
document.all.myDiv.innerHTML = "<b>Hello</b>"

IE4 and IE5 also support the .innerText property.
NN4 supports nothing.