Any way to dynamically write a table's bgcolor?

admin

Administrator
Staff member
Is there a way to access the bgcolor attribute of a table in order to change it dynamically?

I tried giving the table an ID:

<table ID="proxytable" width="450" border="1" cellpadding="0" cellspacing="0" bgcolor="#FFFF33">

And then addressing it using getElementById:

function setBackground(color) {
document.getElementById("proxytable").bgcolor = color;
}

or

function setBackground(color) {
document.getElementById("proxytable").bgcolor.value = color;
}

and - nada. Any suggestions?
 
Back
Top