Foros del Web » Programando para Internet » Javascript »

Id de Checkbox

Estas en el tema de Id de Checkbox en el foro de Javascript en Foros del Web. Hola tengo un problemilla con los id de checkbox ya que al momento de seleccionar una fila mediante checkbox este no me anda, no me ...
  #1 (permalink)  
Antiguo 30/09/2013, 17:52
Avatar de BlinDer  
Fecha de Ingreso: julio-2013
Mensajes: 52
Antigüedad: 10 años, 9 meses
Puntos: 0
Id de Checkbox

Hola tengo un problemilla con los id de checkbox ya que al momento de seleccionar una fila mediante checkbox este no me anda, no me da los ids de las filas seleccionadas pongo a su disposición el codigo y me podrian ayudar, gracias.

Código PHP:
JSP

<%-- 
    
Document   TablaProdcuto
    Created on 
01-oct-201317:34:41
    Author     
mxds
--%>

<%@
page contentType="text/html" pageEncoding="UTF-8"%>
<%@
taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@
taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@
taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<!
DOCTYPE html>
<
html:html>
    <
head>
        <
meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <
title>JSP Page</title>
    </
head>
    <
body>
        <
h1>Hello World!</h1>
        <
table>
            <
thead>
                <
tr>
                    <
th><input type="checkbox" name="all"|></th>
                    <
th>CODIGO</th>
                    <
th>PRODUCTO</th>
                    <
th>PRECIO UNITARIO</th>
                    <
th>SUJETO A CADUCIDAD</th>
                    <
th>FECHA DE INGRESO</th>
                    <
th>FECHA DE SALIDA</th>
                    <
th>EXISTENCIA</th>
                    <
th>EXICTENCIA MINIMA</th>
                    <
th>ALMACEN</th>
                    <
th>PROVEEDOR</th>
                    <
th>IMAGEN</th>
                    <
th></th>
                </
tr>
            </
thead>
            <
tbody>
                <
html:hidden  name="DatoProductoForm" property="idDPF" styleId="idDPF" styleClass="idDPF" />
                <
logic:iterate id="producto" name="DatoProductoForm" property="listDUF" >
                    <
tr class="tr" id="<bean:write name="producto" property="id"/>" onclick="this.style.background = '#00ff09', pseleccionar(this.id), datos(this.id);">
                        <
td style="text-align: center; "><html:checkbox name="producto" property="id" value="id"/></td>
                        <
td style="text-align: center;"><bean:write name="producto" property="codigo"/></td>
                        <
td style="text-align: center;"><bean:write name="producto" property="nombre_producto"/></td>
                        <
td style="text-align: center;"><bean:write name="producto" property="precio_unitario"/></td>
                        <
td style="text-align: center;"><bean:write name="producto" property="caducidad"/></td>
                        <
td style="text-align: center;"><bean:write name="producto" property="fecha_ingreso"/></td>
                        <
td style="text-align: center;"><bean:write name="producto" property="fecha_salida"/></td>
                        <
td style="text-align: center;"><bean:write name="producto" property="existencia"/></td>
                        <
td style="text-align: center;"><bean:write name="producto" property="existencia_min"/></td>
                        <
td style="text-align: center;"><bean:write name="producto" property="proveedor"/></td>
                        <
td style="text-align: center;"><bean:write name="producto" property="imagen"/></td>
                        <
td style="text-align: center;"><html:checkbox name="producto" property="id"/></td>
                    </
tr>
                </
logic:iterate>
            </
tbody>
        </
table>
    </
body>
</
html:html

Código PHP:
JS

function check() {
    
document.getElementById("id of checkbox").checked true;
    var 
checkboxValues = new Array();
    $(
"input:checkbox:checked").each(function() {
        
//cada elemento seleccionado
        
checkboxValues.push($(this).val());
    });
    
alert(checkboxValues);

porfavor necesito ayuda gracias.
  #2 (permalink)  
Antiguo 30/09/2013, 23:56
Avatar de caricatos
Moderador
 
Fecha de Ingreso: abril-2002
Ubicación: Torremolinos (Málaga)
Mensajes: 19.607
Antigüedad: 22 años
Puntos: 1284
Respuesta: Id de Checkbox

Hola:

No sé si tu problema es de java o de javascript... para poder ayudarte en javascript necesitamos el código que ve el navegador (ver código fuente), ya que en el código que nos pasas (java) no se encuentra el checkbox (solo se puede intuír por quien no sabemos java)... y tampoco se ve la llamada a la función que defines, ni la incorporación de la librería (supongo que jquery).

Si el problema es de java, avísanos para mover el tema.

Saludos
__________________
Por favor:
No hagan preguntas de temas de foros en mensajes privados... no las respondo

Etiquetas: checkbox, html, input, js
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:19.