I'm trying to create a css colour switcher which updates the page as soon as a value is selected.
I've got the following javascript function in my page
function changeCol(col,field)
{
if (!DHTML) return;
var x = new getObj(field);
if (col != '')
x.style.color = col;
else
x.style.color = document.change.field.value
}
The user has two options, either select a colour with a button or type in the text code in a text field. The colour is automatically changed when the button is clicked but when the hex code is typed in the user has to click on a change button to change the colour.
col is the new colour
field is the name of the text field which is the same as the div id that will be altered
I want to do this for multiple divs on the same page so I need to change the value of field in 'document.change.field.value' to the value of field
How on earth do I do this?