Ver Mensaje Individual
  #2 (permalink)  
Antiguo 03/04/2013, 18:09
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: javascript onchange

No se entiende muy bien compañero
si
Cita:
ninguna elemento tendra un onchange
quien va a llamar a tu función?

A no ser que lo que quieras es hacer algo más o menos asi
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <title>inicio</title>
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  6. <script type="text/javascript">
  7. //<![CDATA[
  8. function redirije(t){
  9. alert(t.title)
  10. }
  11.  
  12. window.onload = function(){
  13. var linksmenu = [];
  14. var contiene_links = document.getElementById('menu');
  15. linksmenu = contiene_links.getElementsByTagName('button');  
  16.    for (i=0; i<linksmenu.length; i++) {
  17.        if (linksmenu[i].addEventListener){
  18.        linksmenu[i].addEventListener("click", function(){redirije(this)}, false);
  19.        }else{ // <IE9
  20.            if (linksmenu[i].attachEvent){
  21.            linksmenu[i].attachEvent ("onclick", function () {redirije(this)});
  22.        }  
  23.        }
  24.    }
  25. }
  26. //]]>
  27. </head>
  28. <div id="menu">
  29. <button title="1">1</button><br />
  30. <button title="2">2</button><br />
  31. <button title="3">3</button><br />
  32. </div>
  33. </body>
  34. </html>

Es otro ejemplo. pero el concepto es más o menos el mismo, con addEventListener/attachEvent se agrega un evento onclick (vos deberías utilizar change y onchange) a todos los botones, inputs en tu caso, y este evento ejecuta la función redirije, y muestra el title (vos lo harías para el id), del elemento clickeado (ya que se pasa this como parámetro).

A propósito, bienvenido a FDW
Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.