I\'m going to use javascript to make a function for changing color of background, as well as text simultaneously - based on the value of a text input. I\'ve got the backgrou
Depending on which event you actually want to use (textbox change, or button click), you can try this:
HTML:
This text should have the same color as you put in the text box
JS:
function changeBackground(obj) {
document.getElementById("coltext").style.color = obj.value;
}
DEMO: http://jsfiddle.net/6pLUh/
One minor problem with the button was that it was a submit button, in a form. When clicked, that submits the form (which ends up just reloading the page) and any changes from JavaScript are reset. Just using the onchange allows you to change the color based on the input.