JS事件處理的一點細節

 在Javascript中咱們能夠利用下面的方式來給一個HTML元素添加事件:javascript var btn = document.getElementById("btn"); btn.οnclick=function(){alert('hello!');}  固然第二行代碼咱們還能夠修改爲這樣的方式:html btn.οnclick=new Function("alert('hello!'
相關文章
相關標籤/搜索