摘要: var elem = document.getElementById("test"); elem.addEventListener("click",aa,false); //click 代表的是事件, aa代表事件触发执行的函数 function aa(){ alert("aa"); } 阅读全文
posted @ 2017-11-08 23:17 halo-漾 阅读(5297) 评论(0) 推荐(0) 编辑
摘要: var button = { clicked:false, click: function(){ this.clicked = true; assert(button.clicked,"the button has been clicked"); } }; button["click"](); //... 阅读全文
posted @ 2017-11-08 23:14 halo-漾 阅读(248) 评论(0) 推荐(0) 编辑
摘要: function bind(context,name){ return function(){ return context[name].apply(context,arguments); } } 阅读全文
posted @ 2017-11-08 23:13 halo-漾 阅读(125) 评论(0) 推荐(0) 编辑