this JavaScript
odwołanie się do elementu zaznaczonego w form do zmiany koloru tekstu lub tła strony:
<!DOCTYPE html> <html id="b1"> <head> <script> function changeBColor(sel,myParam) { myColor = sel.options[sel.selectedIndex].value; document.getElementById(myParam).style.backgroundColor = myColor; } function changeColor(sel,myParam) { myColor = sel.options[sel.selectedIndex].value; document.getElementById(myParam).style.color = myColor; } </script> </head> <body> <form name="myForm"> kolor nagłowka: <select name="headline" onChange="changeColor(this,'h4');"> <option value="aqua">aqua</option> <option value="green">green</option> <option value="lime">lime</option> <option value="maroon">maroon</option> <option value="navy">navy</option> <option value="silver">silver</option> <option value="teal">teal</option> </select> kolor tła: <select name="bodyBackground" onChange="changeBColor(this,'b1');"> <option value="aqua">aqua</option> <option value="green">green</option> <option value="lime">lime</option> <option value="maroon">maroon</option> <option value="navy">navy</option> <option value="silver">silver</option> <option value="teal">teal</option> </select> </form> </body> </html>
Hope this helps and happy coding :)