SOURCE

console 命令行工具 X clear

                    
>
console
function alertSecond(){
    alert("2");
}
function changeColor(){
    console.log(this.textContent);
    if(this.style.color=="black"){
        this.style.color="red";
    }else{
        this.style.color="black";
    }
}
function changeBackColor(){
    if(this.style.backgroundColor=="Lightskyblue"){
        this.style.backgroundColor="white";
    }else{
        this.style.backgroundColor="Lightskyblue";
    }
}
function changeColorAndBackgroundColor() {
     if (this.style.color == "red") {
            this.style.color = "black";
        }
        else {
            this.style.color = "red";
        }

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

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

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

}

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

       if (this.style.fontSize == "30px") {
            this.style.fontSize = null;
        }
        else {
            this.style.fontSize = "30px";
        }

}


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

        if (this.style.backgroundColor == "lightskyblue") {
            this.style.backgroundColor = "white";
        }
        else {
            this.style.backgroundColor = "lightskyblue";
        }
        if (this.style.fontSize == "30px") {
            this.style.fontSize = null;
        }
        else {
            this.style.fontSize = "30px";
        }
}

function changeFontSizeAndBackgroundColor() {

        if (this.style.backgroundColor == "lightskyblue") {
            this.style.backgroundColor = "white";
        }
        else {
            this.style.backgroundColor = "lightskyblue";
        }
        if (this.style.fontSize == "30px") {
            this.style.fontSize = null;
        }
        else {
            this.style.fontSize = "30px";
        }
}
window.onload=function(){
    var oBtn=document.getElementById("btn");
    oBtn.onclick=function(){
        alert("1");
    }
     oBtn.onclick=function(){
        alert("2");
    } 
    oBtn.onclick=function(){
        alert("3");
    }
     oBtn.onclick=function(){
        alert("1");
        alert("2");
        alert("3");
    }

    function addBorder(){
        if(this.style.fontSize=="30px"){
            this.style.fontSize=null;
        }else{
             this.style.fontSize=="30px";
        }
    }

    var oListenBtn=document.getElementById("listenBtn");
    oListenBtn.addEventListener("click",function(){
        alert("1");
    },false);

    oListenBtn.addEventListener("click",alertSecond,false);
    oListenBtn.addEventListener("click",function(){
        alert("3");
    },false);
    oListenBtn.removeEventListener("click",alertSecond,false);

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

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

    var oRemveBtn1 = document.getElementById("removeBtn1");
    oRemveBtn1.addEventListener("click", function(){
        oPContent1.onclick = changeFontSizeAndBackgroundColor;
    }, false);


    var oRemveBtn=document.getElementById("removeBtn");
    oRemveBtn.addEventListener("click",function(even){
        console.log(event.type);
        oPContent.removeEventListener("click",changeColor,false);
    },false);

     var oPContent1=document.getElementById("content1");
    oPContent1.onclick=function(){
        if(this.style.color=="black"){
        this.style.color="red";
    }else{
        this.style.color="black";
    }
         if(this.style.backgroundColor=="Lightskyblue"){
        this.style.backgroundColor="white";
    }else{
        this.style.backgroundColor="Lightskyblue";
    }
    }

    var oRemveBtn1=document.getElementById("removeBtn1");
    oRemveBtn1.addEventListener("click",function(){
        oPContent.onclick=function(){
               if(this.style.backgroundColor=="Lightskyblue"){
        this.style.backgroundColor="white";
    }else{
        this.style.backgroundColor="Lightskyblue";
    }
        }
    },false);

   document.addEventListener("keydown", function(event){
        console.log(event.type);
        console.log("你按下 " + event.keyCode);
        if (event.altKey) {
            console.log("你按下了Alt");
        }
        if (event.ctrlKey) {
            console.log("你按下了Ctrl");
        }
        if (event.shiftKey) {
            console.log("你按下了Shift");
        }
    }, false)

    document.addEventListener("keyup", function(event){
        console.log(event.type);
        console.log("你松开 " + event.keyCode);
        if (event.altKey) {
            console.log("你松开了Alt");
        }
        if (event.ctrlKey) {
            console.log("你松开了Ctrl");
        }
        if (event.shiftKey) {
            console.log("你松开了Shift");
        }
    }, false) 

    
}

<!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>