正则表达式获取html 中的table
本帖最后由 renjinlong 于 2014-01-03 12:11:31 编辑 <table width="80%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="4">
<img src="img/t-l.png" width="4" height="26" />
</td>
<td>
<div class="inquire-t1">
<img src="img/inquire.gif" width="16" height="16" align="absmiddle" />
查询区
</div>
</td>
<td width="4">
<img src="img/t-r.png" width="4" height="26" />
</td>
</tr>
</table>
<div class="inquire-content">
<FORM name="searchForm" action="resource_anticipation_query_bss1.jsp"
method=post>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr height="30">
<td>
<input name="viewNumber" type="text" id="viewNumber" value="" />
<input type="button" name="button1" id="button1" value="装机地址查询" onclick="queryAll();"
/>
</td>
</tr>
</table>
</FORM>
</div>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">
<div id="tab">
<div class="Menubox">
<ul>
<li id="one1" onclick="setTab('one',1,3)" class=hover>
分线盒地址
</li>
<li id="one2" onclick="setTab('one',2,3)" class=null>
已有用户地址
</li>
<li id="one3" onclick="setTab('one',3,3)" class=null>
在建社区
</li>
</ul>
</div>
<div class="Contentbox">
<div id="con_one_1" class=hover style=0>
<table width="90%" border="0" cellspacing="0" align="left">
<form name="title1" action="#" method="post">
<input type="hidden" name="super_id" value="10" />
<input id="dev_all_page" type="hidden" name="dev_all_page" value="6128"
/>
</form>
</table>
<div class="clear">
</div>
<hr>
<table width="98%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td align="left" width="5%" height="22">
设备类型
</td>
</tr>
<tr bgcolor="E1FFFF">
<td align="left" id="A_0">
LAN
</td>
</tr>
</table>
</div>
<div id="con_one_2" class=null style=display:none>
<table width="90%" border="0" cellspacing="0" align="left">
<form name="title2" action="#" method="post">
<input type="hidden" name="super_id" value="10" />
<input type="hidden" name="partition_code" value="null" />
<input type="hidden" name="zone_cd" value="020" />
<tr align=left height=25>
<td class="noth" width='23%' align=left>
共819709项 第1 到20项
</td>
</tr>
</form>
</table>
<div class="clear">
</div>
<hr>
<table width="80%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td align="left" width="10%" height="22">
设备类型
</td>
</tr>
</table>
</div>
<div id="con_one_3" class=null style=display:none>
<table width="90%" border="0" cellspacing="0" align="left">
</table>
</div>
</div>
</div>
</td>
</tr>
</table>
[解决办法]
jquery ;var table = $("#tableid");
javascript: var table = document.getElementById("tableid");都可以
[解决办法]
无需正则,使用HtmlAgilityPack 搭配 xPath语法,查询文档内容.