joikuspot:js判断table是否为空

判断如下的FileTable合适含有TR,何时不含有TR。即是否为空?

<table id="FileTable" border="0" style="border-width:0px;width:800px;">
 </table>

<table id="FileTable" border="0" style="border-width:0px;width:800px;">
 <tr style="height:24px;">
  <td align="left" style="width:90%;">&nbsp;&nbsp;<a href='#' οnclick="_javascript:ViewFile(2001,'BQC.EMP.1111117077')">4.bmp</a></td><td style="width:600px;white-space:nowrap;">&nbsp;</td>
 </tr>
</table>

JS代码如下:

<script type="text/javascript">

var tableObj = document.getElementById('FileTable').rows[0];
                 if (tableObj == null) {
                     alert('请上传检测报告!');
                     return false;
                 }

</script>

相关推荐

最新

相关文章