
Kod
if(document.form.zaznacz.checked==true)
{
document.form.pole................. i tu che wykonac zmiany koloru tła pola
}
{
document.form.pole................. i tu che wykonac zmiany koloru tła pola
}
Z góry dzięki za odpowiedź.
<script language='JavaScript' type="text/javascript"> <!-- function zmienKolor(a) { if (document.formularz.checkbox1.value="on") document.formularz.text1.style.backgroundColor='red'; } //--> </script> <form name="formularz"> <input type="text" id="text1" /> <br/> <input type="checkbox" id="checkbox1" onclick="javascript:zmienKolor(1)" /> </form>
<input type="checkbox" name="pole" id="pole" class="f" onclick="this.className='t'" />
<style type='text/css'> <!-- .styl1 { background-color: red; } .styl2 { background-color: blue; } .styl3 { background-color: yellow; } //--> </style> <script language='JavaScript' type="text/javascript"> <!-- ktory='text1'; //domyślne ustawienie styl='styl1'; //domyślne ustawienie function zmienKolor(checkbox,ktory,styl) { if (document.getElementById(checkbox).value="on") document.getElementById(ktory).className=styl; } //--> </script> <form name="formularz"> <input type="text" id="text1" /> <input type="text" id="text2" /> <input type="text" id="text3" /> <br/> <input type="checkbox" id="checkbox1" onclick="javascript:zmienKolor(this.id,'text3','styl2')" /> </form>