var oDiv = document.getElementsByTagName("div")[0]; // oDiv.onclick = function(){ // alert(1); // } // oDiv.ondblclick = function(){ // alert(1); // } // oDiv.onclick = alt; // function alt(){ // alert(1); // } // oDiv.onmousedown = function(){ // oDiv.style.background = "yellow"; // } // oDiv.onmouseup = function(){ // oDiv.style.background = "green"; // alert(1); // } // oDiv.onclick = function(){ // oDiv.style.background = "black"; // } // oDiv.onmouseover = function(){ // console.log(1); // } // oDiv.onmouseout = function(){ // console.log(2); // } // oDiv.onmousemove = function(){ // console.log(3); // } // oDiv.onmousedown = function(){ // document.onmousemove = function(e){ // var e = event||window.event; // var oLeft = e.clientX; // var oTop = e.clientY; // oDiv.style.left = oLeft + "px"; // oDiv.style.top = oTop + "px"; // } // document.onmouseup = function(){ // document.onmousemove = null; // } // } // document.onkeypress = function(e){ // var e = event||window.event; // oDiv.innerHTML = e.keyCode; // } // // document.onkeydown = function(){ // console.log(1); // } // // document.onkeyup = function(){ // console.log(2); // } // window.onresize = function(){ // console.log(1); // } // window.oncontextmenu = function(){ // return false; // } // window.onscroll = function(){ // console.log(document.body.scrollTop); // } // window.onscroll = function(){ // if(document.body.scrollTop>=800){ // oDiv.style.display = "block"; // }else{ // oDiv.style.display = ""; // } // }