日期:2014-05-17 浏览次数:20561 次
<table id="test"> <tr> <td><a href="javascript:void(null)">a</a></td> </tr> <tr> <td><a href="javascript:void(null)">a</a></td> </tr> <tr> <td><a href="list.html">a</a></td> </tr> <tr> <td><a href="javascript:void(null)">a</a></td> </tr> <tr> <td><a href="list1.html">a</a></td> </tr> </table>
System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"(?is)(?<=<table id=""test"">[^>""].*?<td><a href=[^>][^(javascript)]*?)[^(javascript)].*?(?=[^<]>)");
------解决方案--------------------
var hrefs = document.getElementById("test").getElementsByTagName("A");
for(a in hrefs){
if(hrefs[a].href!=' javascript:void(null)');
location.href=hrefs[a].href;
break;
}