SOURCE

console 命令行工具 X clear

                    
>
console
function alertSecond(){
    alert("第二次");
}
window.onload = function () 
        {
            var oBtn = document.getElementById("btn");
            oBtn.onclick = function () {
                alert("第1次");
            };
            oBtn.onclick = function () {
                alert("第2次");
            };
            oBtn.onclick = function () {
                alert("第3次");
            };

            var oBtn=document.getElementById("listenBtn");

            oBtn.addEventListener("click",function(){
                alert("第一次");
            },false);

            oBtn.addEventListener("click",alertSecond,false);
            oBtn.removeEventListener("click",alertSecond,false);

            var oPContent=document.getElementById("content")
            oPContent.addEventListener("click",changeColor,false);
            oPContent.addEventListener("click",changeBackgroundColor,false);

            var oBtn1=document.getElementById("removeBtn");

            oBtn1.addEventListener("click",function(){
                oPContent.removeEventListener("click",changeColor,false);
            },false);

            var oPContent1=document.getElementById("content1");
            oPContent1.onclick=changeColor;

            var oBtn2=document.getElementById("removeBtn1");

            oBtn2.addEventListener("click",function(){
                oPContent1.onclick=null;
            },false);

            document.addEventListener("keydown",function(event){
                console.log("你按下啦"+event.keyCode);
            }) 
        } 

        function changeColor(){
            if(this.style.color=="red"){
                this.style.color="black";
            }
            else{
                this.style.color="red";
            }
        }

        function changeBackgroundColor() {
            if (this.style.backgroundColor == "lightskyblue") {
               this.style.backgroundColor = "white";
            }
           else {
               this.style.backgroundColor = "lightskyblue";
            }
   
        } 


        
<!DOCTYPE html> 
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
    <script>
      
    </script>
</head>
<body>
    <input id="btn" type="button" value="按钮"/>
    </br>
    </br>
    <input id="listenBtn"" type="button" value="按钮"/>
    <div>
        <p id="content">广州新华学院</p>

        <button id="removeBtn">解除</button>
    </div> 

    <div>
        <p id="content1">信息科学学院</p>

        <button id="removeBtn1">解除</button>
    </div> 
 
</body>
</html>