Ver Mensaje Individual
  #2 (permalink)  
Antiguo 12/06/2009, 06:01
quimfv
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Sabadell
Mensajes: 4.897
Antigüedad: 16 años, 10 meses
Puntos: 574
Respuesta: marcar check box y que se marque otro de igual nombre.

Yo no repetiria nombres....usaria prefijos....

Supongamos que tenemos

<div z-index=2>
<input name="z2chkbox1" type="checkbox" id="z2chkbox1" value="">
<input name="z2chkbox2" type="checkbox" id="z2chkbox2" value="">
<input name="z2chkbox3" type="checkbox" id="z2chkbox3" value="">
<input name="z2chkbox4" type="checkbox" id="z2chkbox4" value="">

<div z-index=3>
<input name="chkbox1" type="checkbox" id="chkbox1" onClick="cambia(this)" value="">
<input name="chkbox2" type="checkbox" id="chkbox2" onClick="cambia(this)" value="">
<input name="chkbox3" type="checkbox" id="chkbox3" onClick="cambia(this)" value="">
<input name="chkbox4" type="checkbox" id="chkbox4" onClick="cambia(this)" value="">
...


luego puedes hacer

Código js:
Ver original
  1. function cambia(obj){
  2.     if (obj.checked){
  3.         document.getElementById("z2"+obj.id).checked=true;
  4.     }else{
  5.         document.getElementById("z2"+obj.id).checked=false;
  6.     }
  7. }

Simple...

Quim