Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/12/2002, 13:19
Avatar de adex
adex
 
Fecha de Ingreso: marzo-2002
Ubicación: Lima, Perú, América Latina
Mensajes: 445
Antigüedad: 22 años, 1 mes
Puntos: 0
problema con el "checkbox"

Hola amigos, agradecer por anticipado quien me ayude con esta pelea de JS tengo el codigo siguiente pero no logro que al hacer click en el "checkbox" se habilite el cuadro de texto el cual me agrega un contenido ademas me gustaria que al desabilitarlo limpiara el contenido
Gracias a todos:

Saludos
Código PHP:
<html>
 <
head>
<
script language="JavaScript">
   function 
agrega(cLetra) {
    
document.frm.texto.value += cLetra;
   }
</script>
<script>
//"Accept terms" form submission- By Dynamic Drive
//For full source code and more DHTML scripts,
// visit [url]http://www.dynamicdrive.com[/url]
//This credit MUST stay intact for use

var checkobj
function agreesubmit(el){
checkobj=el
if (document.all||document.getElementById){
for (i=0;i<checkobj.form.length;i++){  //hunt down submit button
var tempobj=checkobj.form.elements[i]
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!checkobj.checked
}
}
}
function defaultagree(el){
if (!document.all&&!document.getElementById){
if (window.checkobj&&checkobj.checked)
return true
else{
alert("Please read/accept terms to submit form")
return false
}
}
}

</script>
 </head>
 <body>
  <form name="frm">
   <input name="agreecheck" type="checkbox" name="btA" value="A" onClick="agrega('http://www.')" onClick="agreesubmit(this)">Recomienda
   una pagina<br>
   <input type="text" name="texto" disabled size="20">
  </form>
  <script>
//change two names below to your form's names
document.forms.frm.agreecheck.checked=false
</script>
 </body>
</html>