Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/12/2009, 08:51
Avatar de hector2c
hector2c
 
Fecha de Ingreso: noviembre-2007
Ubicación: Perú - Tacna
Mensajes: 979
Antigüedad: 16 años, 5 meses
Puntos: 25
Pregunta Respuesta: dif ie - firefox (form checkbox)

en primer lugar debes recordar que # es un identificador "único", tal vez ie, no lo tome tan a la ligera como firefox (y creo que esta hace lo correcto)...

puedes usar el siguiente selector: input:checkbox e input:checked

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script language="javascript" type="text/javascript" src="extras/js/jquery/jquery-1.3.2.min.js"></script>
        <script language="javascript" type="text/javascript">
            $(document).ready(function(){
        
                $("#btn_todo").click(function(){
                    $("#frm_persona input:checkbox").each(function(){
                        tr_ide = $(this).parents("tr").attr("id");
                        ide = tr_ide.replace("tr_ide_", "")
                        alert("Ide de persona: " + ide);
                    });
                });
        
                $("#btn_seleccionado").click(function(){
                    $("#frm_persona input:checked").each(function(){
                        tr_ide = $(this).parents("tr").attr("id");
                        ide = tr_ide.replace("tr_ide_", "")
                        alert("Ide de persona: " + ide);
                    });
                });
        
            });
        </script>
    </head>
    
    <body>
    <form id="frm_persona">
        <table>
            <tbody>
                <tr id="tr_ide_1">
                    <td><input type="checkbox" /></td>
                    <td>hector2c</td>
                </tr>
                <tr id="tr_ide_2">
                    <td><input type="checkbox" /></td>
                    <td>conejo</td>
                </tr>
                <tr id="tr_ide_3">
                    <td><input type="checkbox" /></td>
                    <td>edward</td>
                </tr>
                <tr id="tr_ide_4">
                    <td><input type="checkbox" /></td>
                    <td>gissella</td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="2">
                        <input type="button" id="btn_todo" value="Todos" />
                        <input type="button" id="btn_seleccionado" value="Seleccionados" />
                    </td>
                </tr>
            </tfoot>
        </table>
    </form>
    </body>
</html> 
__________________
blog: hector2c.wordpress.com
email: [email protected]