资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
宝儿的zQuery库选择器简单原型
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" _ewebeditor_ta_href="http%3A%2F%2Fwww.w3.org%2FTR%2Fxhtml1%2FDTD%2Fxhtml1-transitional.dtd" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>"> <html xmlns="<a href="http://www.w3.org/1999/xhtml" _ewebeditor_ta_href="http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml" target="_blank">http://www.w3.org/1999/xhtml</a>"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>宝儿的zQuery库选择器简单原型</title> </head> <body> <h1>宝儿的zQuery库选择器简单原型</h1> <div id="idTest"> <ul> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> </div> <div class="classTest"> <ul class="classTest"> <li class="classTest"></li> <li></li> <li></li> <li></li> <li></li> </ul> </div> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20type%3D%22text%2Fjavascript%22%3E%20%0D%0Avar%20zQuery%3Dfunction(ele%2CtagName%2CclassName)%7B%20%0D%0A%20%20%20%20if(!arr)%7Bvar%20arr%3Dnew%20Array()%7D%20%0D%0A%20%20%20%20var%20elem%3Dtypeof(ele)%3D%3D%22object%22%3Fele%3Adocument.getElementById(ele)%3B%20%0D%0A%20%20%20%20if(!tagName)%7B%20%0D%0A%20%20%20%20%20%20%20%20return%20elem%3B%20%0D%0A%20%20%20%20%7Delse%7B%20%0D%0A%20%20%20%20%20%20%20%20if(elem.constructor!%3DArray)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20var%20tags%3Delem.all%26%26!window.opera%3FtagName%3D%3D%22*%22%3Felem.all%3Aelem.all.tags(tagName)%3Aelem.getElementsByTagName(tagName)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20if(!className)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20for(var%20i%3D0%2C%20l%3Dtags.length%3B%20i%3Cl%3B%20i%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20arr.push(tags%5Bi%5D)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7Delse%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20for(var%20i%3D0%2C%20l%3Dtags.length%3B%20i%3Cl%3B%20i%2B%2B)%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if(RegExp(%22(%5E%7C%5C%5Cs%2B)%22%2BclassName%2B%22(%24%7C%5C%5Cs%2B)%22).test(tags%5Bi%5D.className))%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20arr.push(tags%5Bi%5D)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%7Delse%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20for(var%20i%3D0%2C%20l%3Delem.length%3B%20i%3Cl%3B%20i%2B%2B)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20arr%3Darr.concat(zQuery(elem%5Bi%5D%2CtagName%2CclassName))%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%7D%20%0D%0A%20%20%20%20return%20arr%3B%20%0D%0A%7D%20%0D%0Avar%20%24%3DzQuery%3B%20%0D%0Aalert(%20%24(%22idTest%22).id%20)%3B%20%0D%0Aalert(%20%24(%22idTest%22%2C%22li%22).length)%3B%20%0D%0Aalert(%20%24(document%2C%22div%22).length%20)%3B%20%0D%0Aalert(%20%24(%20%24(document%2C%22div%22)%2C%22ul%22).length%20)%3B%20%0D%0Aalert(%20%24(%20%24(%20%24(document%2C%22div%22)%2C%22ul%22)%2C%22li%22).length%20)%3B%20%0D%0Aalert(%20%24(document%2C%22div%22%2C%22classTest%22).length%20)%3B%20%0D%0Aalert(%20%24(%20%24(document%2C%22div%22%2C%22classTest%22)%2C%22ul%22%2C%22classTest%22).length%20)%3B%20%0D%0Aalert(%20%24(%20%24(%20%24(document%2C%22div%22%2C%22classTest%22)%2C%22ul%22%2C%22classTest%22)%2C%22li%22%2C%22classTest%22).length%20)%3B%20%0D%0A%3C%2Fscript%3E"> </body> </html>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程