日期:2014-05-16 浏览次数:20314 次
<td class="test"><span id="aaa:bbb555:ccc">Search results111</span></td> <td class="test"><span id="aaa:bbb666:ccc">Search results222</span></td> <td class="test"><span id="aaa:bbb777:ccc">Search results333</span></td> .... ....
var element = document.getElementById('aaa:bbb777:ccc'); if (element) element.style.color = 'red';
------解决方案--------------------
span_list = document.getElementByTagName('span') for(i=0;i<span_list.length;i++){ span_item = span_list[i]; if(/aaa:bbb\d+:ccc/.test(span_item.Attributes("id")))span_item.style.color = "#F00"; }