Created
August 27, 2013 07:12
-
-
Save mygoare/6350535 to your computer and use it in GitHub Desktop.
sizzle.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lcq={};//全局变量 | |
(function($){ | |
$.get=Sizzle; | |
$.bind=function(element,event,fn){if(element){if(element.addEventListener){console.info("addEventListener"); element.addEventListener(event,fn,false);}else{console.info("attachEvent"); element.attachEvent("on"+event,fn);}} | |
} | |
})(lcq); //自执行函数表达式 | |
function _test(){ alert(lcq.get("#dv1")[0].innerHTML); } | |
//窗口加载事件 | |
window.onload=function(){ | |
lcq.bind(lcq.get("#btnTester")[0],"click",_test);/*给按钮绑定事件*/ | |
lcq.bind(lcq.get("#btnClass")[0],"click",function(){alert(lcq.get("ul.list li:first")[0].innerHTML);}); | |
lcq.bind(lcq.get("#btnSpan")[0],"click",function(){ alert(lcq.get("div>span")[0].innerHTML);}); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment