js解析html字符串

var html = '<html>  <body>  <table class="featureInfo">  <caption class="featureInfo">sandong_R</caption>  <tr>  <th>fid</th>    <th >TYPE_USER</th>    <th >USER_SUBTY</th>    <th >NAME</th>  </tr>    <tr>  <td>sandong_R.14</td>          <td>100</td>      <td>100</td>      <td>枣庄市</td>  </tr></table><br/>  </body></html>';  


var el = document.createElement( 'div' );
el.innerHTML = html;
var tds = el.getElementsByTagName('td');
var text = tds[3].innerHTML;
alert(text);//枣庄市



转载自:https://blog.csdn.net/inrtyx/article/details/20450169

You may also like...

退出移动版