------用事件监听事件来实现-----
<button>按钮</button>
<script>
var but = document.querySelector("button")
//添加监听事件
but.addEventListener("click",hello1)
but.addEventListener("click",hello2)
function hello1(){
alert("hello1")
}
function hello2(){
alert("hello2")
}
</script>
网友评论