Ver Mensaje Individual
  #6 (permalink)  
Antiguo 04/05/2012, 19:50
TheSisziWeb
 
Fecha de Ingreso: mayo-2011
Mensajes: 3
Antigüedad: 12 años, 11 meses
Puntos: 0
Respuesta: Check list en php o java scrip

Buenas noches
bueno en realidad lo necesito hacer en html utilizando algunas funciones de java scrip, por que html por que donde lo voy a utilizar no puedo ejecutar un servidor apache de lo contrario lo haria en php, yo ya tengo el check list con html y java scrip pero solo me muestra los datos de la casilla seleccionada en una casilla de texto y lo rincipal que necesito es que lo muestre en un area de texto en ejemplo:
0 Perro.
0 Gato.
0 Gallina.

si selecciono perro y gallina:
que en un area de texto me muestre :I perro // gallina I
como lo tengo hecho me muestra
Igallina I
Iperro I

el codigo es:


<html>
<head>
<title>Productos</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="estilos.css" rel="stylesheet" type="text/css">

<script language="JavaScript" type="text/JavaScript">
<!--
function traervalor(queCheck){
var check= document.getElementById(queCheck);
if(check.checked){
var descarte = check.value;
document.getElementById("t"+queCheck).value=descar te;
return descarte;
}
}
function asignar(){
var checklist = "";
checklist=traervalor("Producto1");
checklist=traervalor("Producto2");
checklist=traervalor("Producto3");
checklist=traervalor("Producto4");

return checklist;

}
function mostrar(){
document.getElementById("total").value = asignar();
}

//-->
</script>
</head>
<body>
<form name="form1" method="post" action="">
<table width="100%" height="196" border="0">
<tr>
<td align="right"><input name="Producto1" type="checkbox" id="Producto1" onClick="mostrar()" value="Gallina"></td>
<td>Gallina</td>
<td><input name="t1" type="text" id="tProducto1" value="" size="50"></td>
</tr>
<tr>
<td align="right"><input onClick="mostrar()" name="Producto2" type="checkbox" id="Producto2" value="Perro"></td>
<td>Perro</td>
<td><input name="tProducto3" type="text" id="tProducto2" value="" size="50"></td>
</tr>
<tr>
<td align="right"><input onClick="mostrar()" name="Producto3" type="checkbox" id="Producto3" value="Gato"></td>
<td>Gato</td>
<td><input name="tProducto2" type="text" id="tProducto3" value="" size="50"></td>
</tr>
</table>
<table width="100%" height="36" border="0">
</table>
<table width="100%" height="32" border="0">

</table>
<table width="100%" height="37" border="0">
</table>
<p>
<label>
<input type="reset" name="button" id="button" value="Restablecer">
</label>
</p>
<p>
<label>
<textarea name="textarea" id="textarea" cols="150" rows="5"></textarea>
</label>
</p>
</form>
</body>
</html>