I want to change html element's attributes with javascript. It's possible, right? I saw tutorials on w3schools.com about that and it works.
I find a problem myself and I can't find what's wrong with my code.
I generate a table within php. I give each <td> element an ID with a numeric value (1 to 31) and a onclick event which should start javascript function to change that <td> element's bgcolor value:
Code: Select all
function changeColor(id)
{
var x=document.getElementById(id)
x.bgcolor="#000000"
alert("Done. Color: " + x.bgcolor)
}Thanks very much.