Ver Mensaje Individual
  #6 (permalink)  
Antiguo 28/09/2009, 01:10
quimfv
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Sabadell
Mensajes: 4.897
Antigüedad: 17 años
Puntos: 574
Respuesta: Ayuda consulta a 2 tablas con campo comun

Mandanos "addCampo()" para ver como creas el array....

Mientras esto te puede dar pistas....

Código HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
var matriu=new Array(5);
function inserta(){
for (i=0;i<5;i++){
	var parell=new Array(2);
	parell[0]=document.getElementById("c"+i).value;
	if (document.getElementById("v"+i).checked){
		parell[1]=true;
	}else{
	parell[1]=false;
	}
	matriu[i]=parell;
}
}

function mostra(){
var resultat="";
for (i=0;i<5;i++){
	resultat+=matriu[i][0] + "&nbsp;" +  matriu[i][1] + "<br>";
}
document.getElementById("resultats").innerHTML=resultat;
}
</script>
</head>
<body>
<form action="" method="get" name="form1">
<input name="c0" type="text" id="c0" value="1">&nbsp;<input name="v0" type="checkbox" id="v0" value="false"><br>
<input name="c1" type="text" id="c1" value="2">&nbsp;<input name="v1" type="checkbox" id="v1" value="false"><br>
<input name="c2" type="text" id="c2" value="3">&nbsp;<input name="v2" type="checkbox" id="v2" value="false"><br>
<input name="c3" type="text" id="c3" value="4">&nbsp;<input name="v3" type="checkbox" id="v3" value="false"><br>
<input name="c4" type="text" id="c4" value="5">&nbsp;<input name="v4" type="checkbox" id="v4" value="false"><br>
<input name="" type="button" onClick="inserta();mostra()" value="Enter">
</form>
<span id="resultats">&nbsp;</span>
</body>
</html> 
Quim