Ciao a tutti,
mi servirebbe uno script che mi disabilitasse due select (chiamate select_1 e select_2) di un form (chiamato form_1) quando una checkbox dello stesso form assume il valore checked.
Mi potete aiutare??
Grazie
Ciao a tutti,
mi servirebbe uno script che mi disabilitasse due select (chiamate select_1 e select_2) di un form (chiamato form_1) quando una checkbox dello stesso form assume il valore checked.
Mi potete aiutare??
Grazie
credo che se assegni in id al select....
metti una funzione al click del ceckbox... che controlla se è ceccato o no
e dopo credo che puo fare..
getElementById("idselect").Enabled=false;
Cercavi una cosa del genere?
codice:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs"> <head> <meta name="generator" content="PSPad editor, www.pspad.com" /> <meta http-equiv="content-type" content="text/html; charset=iso-8859-2" /> <title>Untitled</title> <script> function abilita(status){ var a=document.getElementById('sel1'); var b=document.getElementById('sel2'); a.disabled=(status==true)?false:true b.disabled=(status==true)?false:true } </script> </head> <body onLoad="abilita(document.getElementById('check0'))"> <input type="checkbox" onCLick="abilita(this.checked)" name="test" value="1" id="check0"/> <select size="1" name="a" id="sel1"> <option>a</option> <option>b</option> </select> <select size="1" name="b" id="sel2"> <option>c</option> <option>d</option> </select> </body> </html>![]()
Non sempre essere l'ultimo è un male... almeno non devi guardarti le spalle
il mio profilo su PHPClasses e il mio blog laboweb
Grazie ad entrambi per le risposte.
Ho modificato il codice di dottwatson altrimenti avevo le checkbox disabilitate all'apertura della pagina:
codice:<script> function abilita(status){ var a=document.getElementById('fa_parte_macro'); var b=document.getElementById('fa_parte_cate'); var c=document.getElementById('link'); a.disabled=(status==true)?true:false b.disabled=(status==true)?true:false c.disabled=(status==true)?true:false } </script>