📌  相关文章
📜  在javascript代码示例中单击时如何使按钮在两个函数之间跳转

📅  最后修改于: 2022-03-11 15:03:57.277000             🧑  作者: Mango

代码示例1
function buttonClick() {
    //do stuff
    this.onclick = notButtonClick; //function reference to nBC
}

function notButtonClick() {
    //do more stuff
    this.onclick = buttonClick; //function reference to original function
}

var el = document.getElementById("numberonebutton"); //let for ES6 aficionados 
el.onclick = buttonClick; //again, function reference, no ()