在javascript中,有时候需要动态改变 onclick事件,可以这么做:var newA=document.createElement('A'); newA.οnclick=function(){ alert(1); }