Ver Mensaje Individual
  #5 (permalink)  
Antiguo 07/03/2013, 07:30
Avatar de IsaBelM
IsaBelM
Colaborador
 
Fecha de Ingreso: junio-2008
Mensajes: 5.032
Antigüedad: 15 años, 10 meses
Puntos: 1012
Respuesta: control de carga de videos

lo he probado y funciona. puedes hacer estas correcciones, pero ya te digo que el código es correcto
Cita:
<!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" />
<title>Documento sin título</title>
<script>
//function nuevoEvento(elemento, evento, funcion) { elemento.addEventListener(evento, funcion, false); }

function nuevoEvento(elemento, nomevento, fnc) {

if (elemento.addEventListener) {
elemento.addEventListener(nomevento, function(e) { fnc.call(elemento, e); }, false);
} else if (elemento.attachEvent) {
elemento.attachEvent('on' + nomevento, function() { fnc.call(elemento); });
}
}


function mensaje() { alert("boton pulsado"); }
function inicia() {
var divs = document.querySelectorAll('button.btn');
for (var i = 0; i < divs.length; i++) {
nuevoEvento(divs[i],"click",function() {mensaje()});
}
}


window.onload = function(){inicia()};
</script>
</head>
<body>
<button class='btn'>Hola0</button>
<button class='btn'>Hola1</button>
<button class='btn'>Hola2</button>
<button class='btn'>Hola3</button>
<button class='btn'>Hola4</button>
</body>
</html>
__________________
if(ViolenciaDeGénero) {alert('MUJER ASESINADA');}