var arr=[];
var eles=document.getElementsByTagName("*");
for(var i=0;i<eles.length;i++){
if(eles[i].innerHTML=='100'||eles[i].value=='100'){
arr.push(eles[i]);
}
}
试试

解决方案 »

  1.   

    这个100不是每次都是这个值,是动态的 ,最好是jquery的写法
      

  2.   

    $('div.m_con m_jk>div:visible .num').text()  这么取还是没取道,求高手指点写法
      

  3.   

    <!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=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript" src="jquery-1.7.2.js"></script>
    <script type="text/javascript">
    $(function(){
    $('span').each(function(){
    if($(this).text()==100){
    alert('a');
    }
    })
    })
    </script>
    </head><body>
     <div class="m_con m_jk">
    <div id="tab1">
    <div class="m_jk_c m_tab_c">
    <div style="display: block">
    <table>
    <tr>
    <td class="wd1"><span class="m_ico2_1"></span></td>
    <td class="td1"></td>
    <td colspan="4">
    <div class="m_progress progress1">
    <div class="m_progress_start">500</div>
    <div class="m_progress_range">
    <div class="m_progress_percent_bg">
    <div class="m_progress_percent"></div>
    </div>
    <div class="m_progress_cursor"></div>
    <div class="m_progress_cursor_title">
    <span class="num">100</span>
    <div class="corner"></div>
    </div>
    </div>
    <div class="m_progress_end">3000</div>
    </div>
    </td>
    </tr>
    </table>
    </div>
    <div style="display: block">2</div>
    </div>
    </div>
    </div> 
    </body>
    </html>
      

  4.   

    如何取道<div style="display: block">这个下面的呢?因为<div style="display: block"></div>下也有可能有的
      

  5.   

    $('div.m_con div:visible .num').text()第一个div后面的class,不要添加两个啊,你加了空格,就变成子元素了还有大于号,那个是求紧挨着的子元素的,你看看你那边,紧挨着的子元素是id=tab1的子元素。我现在的这样的写法,是能取到的,不符合你的要求吗?
      

  6.   


    如果你要限定包含两个className的话,中间不要加空格,而是两个.class连写:$('div.m_con.m_jk>div:visible .num').text()
      

  7.   

    <!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=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript" src="jquery-1.7.2.js"></script>
    <script type="text/javascript">
    $(function(){
    $('*').each(function(){
    if($(this).html()==100){
    alert($(this)[0].tagName);
    }
    })
    })
    </script>
    </head><body>
     <div class="m_con m_jk">
    <div id="tab1">
    <div class="m_jk_c m_tab_c">
    <div style="display: block">
    <table>
    <tr>
    <td class="wd1"><span class="m_ico2_1"></span></td>
    <td class="td1"></td>
    <td colspan="4">
    <div class="m_progress progress1">
    <div class="m_progress_start">100</div>
    <div class="m_progress_range">
    <div class="m_progress_percent_bg">
    <div class="m_progress_percent"></div>
    </div>
    <div class="m_progress_cursor"></div>
    <div class="m_progress_cursor_title">
    <span class="num">100</span>
    <div class="corner"></div>
    </div>
    </div>
    <div class="m_progress_end">3000</div>
    </div>
    </td>
    </tr>
    </table>
    </div>
    <div style="display: block">2</div>
    </div>
    </div>
    </div> 
    </body>
    </html>
      

  8.   

    谢谢 ,<div class="m_con m_jk">这个class一定要叫这个名字的,是否可以取到
      

  9.   

    var value = $('div.m_con.m_jk div:visible .num').text();这样写能取道,但是我想加上m_progress progress1下的<span class="num">的值,因为还有别的节点 ,求教该如何写
      

  10.   


    $('div.m_con.m_jk div:visible .m_progress .num').text()