
Eventos en Javascript
By:
Jesse315 on
Jun 14th, 2012 | syntax:
JavaScript | size: 0.70 KB | hits: 26 | expires: Never
<!DOCTYPE HTML>
<html lang="es-VE">
<head>
<title> Javascript </title>
<meta charset="UTF-8"/>
</head>
<body>
<button id="miButton">Click Aqui!</button>
<script type="text/javascript">
window.addEventListener("load",function(){
alert("La pagina ha cargado satisfactoriamente");
});
var boton = document.getElementById("miButton");
window.addEventListener("keydown",tecla_pulsada);
boton.addEventListener("click",boton_pulsado);
function boton_pulsado(evento){
alert("Has pulsado el boton");
boton.removeEventListener("click");
alert(evento.type);
}
function tecla_pulsada(event){
alert(event.keyCode);
}
</script>
</body>
</html>