Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/04/2010, 04:25
Dany_s
 
Fecha de Ingreso: diciembre-2009
Ubicación: Misiones
Mensajes: 867
Antigüedad: 14 años, 5 meses
Puntos: 65
Respuesta: Focalizar en un div

también con focus pero el div debe tener el atributo tabindex


Código HTML:
<html>
<head>
    <title>Prueba</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
    <script>
    $( function (){
        $('div').focus( function (){
            $(this).css('backgroundColor', 'red');
        }).blur( function (){
            $(this).css('backgroundColor', 'green');
        });
            
    });
    </script>
    <style>
        div { width:200px; height:200px; background-color:blue; margin:5px}
    </style>
</head>
<body>
    <div tabindex="1"></div>
    <div tabindex="2"></div>
</body>
</html>