正则表达式基础学习一
2013-04-17 21:08
162 查看
<!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" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>Document</title> </head> <body> <div class="box box-link in-home"></div> <div class="box-link in-home box"></div> <div class="box-link box in-home"></div> <div class="box"></div> <div class="box-link in-home"></div> <script type="text/javascript"> var reg = /(^| )box( |$)/; var elems = document.getElementsByTagName("div"); for (var i = 0; i < elems.length; i++) { //console.log(elems[i].className); if (elems[i].className.match(reg) !== null) { console.log("true"); } else { console.log("false"); } }; </script> </body> </html>
检测div里的class是否存在box
相关文章推荐
- python基础学习笔记-正则表达式
- python基础学习-正则表达式
- 信息安全系统设计基础第十三周学习总结
- 【java学习笔记】反射基础
- C#2005 .NET3.0高级编程学习笔记———C#基础
- HTML<css+div> 基础学习
- MySQL学习笔记之一:数据库基础理论及客户端工具的使用
- Java EE基础知识学习(二)
- c语言基础学习11_项目实战:IDE(集成开发环境)
- Jave基础学习:jdbc小技巧
- 基础知识02 - 零基础入门学习汇编语言02
- android学习——必学基础组件
- Oracle 学习笔记 查询(重点,也是基础)
- cocos2dx基础类型学习
- 1、C++入门--基础--开始学习C++
- 学习OpenStack之 (0):基础知识
- Python基础教程 第10章: 自带电池(模块) 学习笔记
- Pytho基础学习--第十篇(函数式编程)
- Java基础学习
- Java学习总结11——基础类库2(容器1)