首页 / JQUERY / jQuery的层级查找方式分析
jQuery的层级查找方式分析
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了jQuery的层级查找方式分析,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2537字,纯文字阅读大概需要4分钟。
内容图文
本文实例分析了jQuery的层级查找方式。分享给大家供大家参考,具体如下:
下面使用jquery的层级查找方式
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <script src="jquery-1.6.2.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready( function(){ /*第一种方式层级查找,查找的是a标签对象——选择器*/ $('.thumb-hover a:has(img)').each(function(){ alert($(this).attr("pid")); }); /*第三种层级查找,使用方法进行筛选——筛选器*/ $('.thumb-hover a').has("img").each(function(){ alert($(this).attr("pid")); }); /*第二种方式层级查找,查找的是img标签对象——基本层级选择器*/ $('.thumb-hover a img').each(function(){ alert($(this).attr("alt")); }); } ); </script> <title>无标题文档</title> </head> <DIV class=thumb sizcache="17" sizset="84"> <SPAN class=thumb-hover sizcache="17" sizset="84"> <A class=lightbox-enabled href="/user/showuser.php?uid=u1373373094&tab=photo&view=photo_detail&pid=72464692#detail" target=_blank pid="72464692" oid="27" src="http://pic03.babytreeimg-dev.com/foto3/thumbs/2012/0106/43/8/51dc02a6279c0ef6c728e5_mb.jpg" jQuery1640004568396895048288="1"> <IMG alt=DSC_0723.JPG src="http://pic05.babytreeimg-dev.com/foto3/thumbs/2012/0106/43/8/51dc02a6279c0ef6c728e5_sm.jpg"> </A> <SPAN style="DISPLAY: none" id=72464692 class=mouse-wrap> <IMG class=unselect src="http://pic.babytree.com/img/mybabytree/photo/pix.png"> </SPAN> </SPAN> </DIV> <DIV class=thumb> <SPAN class=thumb-hover sizcache="0" sizset="2"> <A class=lightbox-enabled href="/user/showuser.php?uid=u3073373044&tab=photo&view=photo_detail&pid=72464732#detail" target=_blank pid="72464732" oid="5" src="http://pic02.babytreeimg-dev.com/foto3/thumbs/2012/0216/48/9/b72ff3742c8c172650a0d1_nb.jpg" jQuery16405726906849340585="1"><IMG alt=Koala.jpg src="http://pic01.babytreeimg-dev.com/foto3/thumbs/2012/0216/48/9/b72ff3742c8c172650a0d1_sm.jpg"> </A> <SPAN style="DISPLAY: none" id=72464732 class=mouse-wrap> <IMG class=unselect alt=DSC_0724.JPG src="http://pic.babytree.com/img/mybabytree/photo/pix.png"> </SPAN> </SPAN> </DIV> <body> </body> </html>
更多关于jQuery相关内容感兴趣的读者可查看本站专题:《jQuery常用插件及用法总结》、《jquery中Ajax用法总结》、《jQuery表格(table)操作技巧汇总》、《jQuery拖拽特效与技巧总结》、《jQuery扩展技巧总结》、《jQuery常见经典特效汇总》、《jQuery动画与特效用法总结》及《jquery选择器用法总结》
希望本文所述对大家jQuery程序设计有所帮助。
内容总结
以上是互联网集市为您收集整理的jQuery的层级查找方式分析全部内容,希望文章能够帮你解决jQuery的层级查找方式分析所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。