elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado:


  Mostrar Mensajes
Páginas: 1 2 [3] 4 5 6
21  Programación / Desarrollo Web / Evento onfocus en fila de una tabla en: 25 Enero 2013, 12:58 pm
Hola, muy buenas! :)

Tengo una tabla en HTML, y quiero que cada vez que se haga click en una fila, esta quede resaltada de un color diferente y si se hace click en otra fila, la anterior vuelva a su color inicial y la nueva que resaltada.

Para hacer esto, he pensado usar los eventos onfocus y onblur. Segun W3C puedo usar este evento en el tag <tr>. http://www.w3schools.com/jsref/event_onfocus.asp

Y tengo el siguiente codigo:

Código
  1. <!DOCTYPE html>
  2. function myFunction(x)
  3. {
  4. x.style.background="yellow";
  5. }
  6. function myFunction2(x)
  7. {
  8. x.style.background="white";
  9. }
  10. </head>
  11. <tr>
  12. <th>Product</th>
  13. <th></th>
  14. <th>Price</th>
  15. <th>Cost</th>
  16. <th></th>
  17. </tr>
  18. <tr onfocus="myFunction(this)" onblur="myFunction2(this)">
  19. <td>ProductName01</td>
  20. <td>1x</td>
  21. <td>35.20€</td>
  22. <td>35.20€</td>
  23. <td>x</td>
  24. </tr>
  25. <tr  onfocus="myFunction(this)" onblur="myFunction2(this)">
  26. <td>ProductName01</td>
  27. <td>1x</td>
  28. <td>35.20€</td>
  29. <td>35.20€</td>
  30. <td>x</td>
  31. </tr>
  32. <tr  onfocus="myFunction(this)" onblur="myFunction2(this)">
  33. <td>ProductName01</td>
  34. <td>1x</td>
  35. <td>35.20€</td>
  36. <td>35.20€</td>
  37. <td>x</td>
  38. </tr>
  39. </tbody>
  40. </body>
  41. </html>

Ahora mi pregunta es, que problema hay? porque no se ejecutan los scripts?

Muchas gracias! :)
22  Programación / Scripting / Re: [Python] Redimensionar un array en: 17 Octubre 2011, 01:00 am
para quien tenga la misma duda que yo, aquí esta:

Código
  1. vector = [None]*longitud
23  Programación / Scripting / [Python] Redimensionar un array en: 15 Octubre 2011, 13:28 pm
Hola,

Tengo un problema en un programa en python. Estoy realizando la classe CArray y el constructor es el siguiente:

def __init__(self, length, baseIndex):
""“ (Array, int) -> None
     Constructs an array of the given length. """

Los atributos de la classe son:
   
Código
  1. __slots__ = ['__data','__baseIndex']

Donde __data es una lista y __baseIndex es el valor del indice correspondiente al primer elemento.

Mi pregunta es la siguiente, si al constructor me pasan como parametro length(longitud), como puedo dimensionar __data para que tenga longitud length?


Muchas gracias!
24  Foros Generales / Noticias / Re: Chrome, Safari y Office son las “aplicaciones más sucias” del año en: 19 Noviembre 2010, 01:35 am
Me parece que No-script no esta en chrome
25  Programación / Programación C/C++ / Re: Ayuda con codigo c simple en: 18 Septiembre 2010, 02:40 am
Identación o Indentación esta bien escrito de las dos formas.

Aquí la referencia: http://es.wikipedia.org/wiki/Indentaci%C3%B3n
26  Programación / Programación C/C++ / Re: función de seguimiento de errores en: 20 Junio 2010, 17:17 pm
Código
  1. unsigned int sasfid()
  2. {
  3. FGE Actual;
  4. Actual.fState =STATE_A;
  5. Actual.fStateError =STATE_A;
  6. Actual.fContError =STATE_A;
  7.  
  8. if (Actual.fState!=0 && Actual.fStateError!=0 && Actual.fContError !=0) return STATE_B;
  9. else return STATE_A;
  10. }


Pero por lo que veo, esta función siempre te va a devolver lo mismo, STATE_A. Supongo que le pasaras Actual como parametro de entrada, no?
27  Programación / Java / Re: Ayuda con problema de animacion en: 17 Junio 2010, 21:14 pm
Espero que este codigo te ayude...


Código
  1.  
  2. import java.awt.BorderLayout;
  3. import java.awt.Color;
  4. import java.awt.Graphics;
  5. import java.awt.event.ActionEvent;
  6. import java.awt.event.ActionListener;
  7. import java.util.Random;
  8. import javax.swing.*;
  9.  
  10. class Ventana implements Runnable
  11. {
  12.  
  13.    private JLabel boton=new JLabel();
  14.    private JFrame principal;
  15.    private BorderLayout border;
  16.    JPanel panelbotones,panel;
  17.    private JButton agregar;
  18.    private Random r=new Random();
  19.    int x=0,y=0;
  20.    ImageIcon icono;
  21.    public  Ventana()
  22.    {
  23.       principal=new JFrame("Hormigas");
  24.       principal.setBounds(500,110,500,500);
  25.       border=new BorderLayout();
  26.       principal.setLayout(border);
  27.       panelbotones=new JPanel();
  28.       panel=new JPanel();
  29.       panel.setLayout(null);
  30.       panelbotones.setBackground(Color.WHITE);
  31.       panel.setBackground(Color.white);
  32.       principal.add(panel,BorderLayout.CENTER);
  33.       principal.add(panelbotones,BorderLayout.NORTH);
  34.  
  35.       principal.setVisible(true);
  36.       agregar=new JButton("Agregar Hormiga");
  37.       agregar.addActionListener(new ActionListener()
  38.       {
  39.  
  40.            public void actionPerformed(ActionEvent e)
  41.            {
  42.             Ventana.this.andar();
  43.  
  44.            }
  45.        });
  46.  
  47.       panelbotones.add(agregar);
  48.       principal.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  49.       principal.setVisible(true);
  50.    }
  51.  
  52.  private Timer temps2 = new Timer(30000, new ActionListener(){ // Crono2, Cada 30000 milisegundos genera este evento
  53.                public void actionPerformed(ActionEvent e) {
  54.                   boton.setVisible(false);
  55.                   temps1.stop();                              
  56.                   temps2.stop();
  57.                }
  58.  });
  59.  
  60.  private Timer temps1 = new Timer(500, new ActionListener(){   // Crono1, Cada 500 milisegundos genera este evento
  61.                public void actionPerformed(ActionEvent e) {
  62.  
  63.                    icono=new ImageIcon("C:\\Imagen");
  64.                    x=r.nextInt(800);
  65.                    y=r.nextInt(800);
  66.                    boton.setIcon(icono);
  67.                    boton.setBounds(x, y,100,100);
  68.                    Ventana.this.panel.add(boton);
  69.                    panel.updateUI();
  70.  
  71.                }
  72.  });
  73.  
  74.  public void andar()
  75.  {
  76.      System.out.println("La hormiga anda");
  77.      Thread hilo  = new Thread(this);
  78.      hilo.start();
  79.      temps2.start();
  80.  }
  81.  
  82.    public void run()
  83.    {
  84.        System.out.println("El Thread funciona");
  85.        temps1.start();
  86.        this.mover();
  87.  
  88.    }
  89.  
  90.    public void mover()
  91.    {
  92.        System.out.println("La hormiga se mueve");
  93.        x = r.nextInt(800);
  94.        y = r.nextInt(800);
  95.        boton.repaint();
  96.    }
  97.  
  98.    public void paint(Graphics g)
  99.    {
  100.        g.clearRect(x, y, icono.getIconWidth(), icono.getIconHeight());
  101.        g.drawImage(icono.getImage(), x, y, icono.getImageObserver());
  102.    }
  103.  
  104.  
  105. }
28  Programación / Java / Re: Ayuda con problema de animacion en: 16 Junio 2010, 15:39 pm
Para mover la imagen de forma aleatoria, usaria la clase timer, para q cada un segundo, me la ponga a un sitio aleatorio del formulario.


Luego por la noche, te pego un codigo ;)
29  Foros Generales / Noticias / Re: Dell: “Ubuntu es más seguro que Microsoft Windows" en: 15 Junio 2010, 15:55 pm
Pregunta para DELL: Y entonces, porque razon no vendeis mas portatiles con Ubuntu instalado???

Compre un DELL y me comí el windows seven con patatas.
Compra un ordenador "limpio" sin ningún SO preinstalado, te ahorras el precio del SO y de la instalación y luego le metes el Ubuntu si quieres ese.

DELL no vende sin SO preinstalado. Y solo tiene 2 modelos disponibles con Ubuntu. Que daño hacen las licencias OEM...
30  Foros Generales / Noticias / Re: Dell: “Ubuntu es más seguro que Microsoft Windows" en: 15 Junio 2010, 14:33 pm
Pregunta para DELL: Y entonces, porque razon no vendeis mas portatiles con Ubuntu instalado???

Compre un DELL y me comí el windows seven con patatas.
Páginas: 1 2 [3] 4 5 6
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines