PDA

View Full Version : innerHTML question


gigsvoo
05-29-2002, 05:37 AM
Hi there,

i wanna get a innerHTML to work with, but to assign the variable to it?

Let say my code is:

document.form1.text1.value = var1.innerHTML

where var1 is the id of a <TD>...

Thanks

Neo

Jon Hanlon
05-29-2002, 06:15 PM
That code will work for IE4+, for NS6 you need to do:
document.form1.text1.value = document.getElementById("var1").innerHTML

gigsvoo
05-29-2002, 10:16 PM
I was trying to write ths line of code, but it always return me a undefined data.

document.all.editField2.value=x.innerText;

where x is a variable that have the cell id of the table, in this case is a11. If I ran the code above, it gave me undefined error, yet if I hardcoded the x with a11. then it works!

any ideas?

gigsvoo
05-29-2002, 11:01 PM
I had found the solution:

document.all.editField2.value=document.all[x].innerText;

and it works! :)