Ciao a tutti,
sto provando a smanettare un pò con il javascript, vi pongo il mio problema, voglio attivare/disattivare un elemento textarea usando un ceckbox,
Ecco il mio codice, l'errore è che riesco solo disattivarlo e non ad attivarlocodice:<!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Javascript</title> <script type="text/javascript"> function Attivazione (){ var ditta=document.getElementById("DI"); var piva=document.getElementById("PI"); ditta.checked ? piva.disable= 'true' : piva.disabled= 'false' ; //ditta.checked ? document.write("True") : document.write("False"); } </script> </head> <body> <input type="checkbox" id="DI" onclick="Attivazione ();" value="" /> <textarea name="" cols="" rows="" id="PI"></textarea> </body> </html>

Rispondi quotando