使网页的第一个表格边框不显示出来的代码是什么

来源:百度知道 编辑:UC知道 时间:2024/06/16 00:10:35
假设一个网页从上到下由几个表格组成,如:
<body>
<table width="1003" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1003" height="109" valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
</table>
<table width="1003" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1003" height="109" valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
</table>
<table width="1003" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1003" height="109" valign="top

这个用Javascript就可以实现,把下面代码加到页面最后面:
<script>
var table=document.getElementsByTagName("table");
table[0].style.display="none";
</script>

用一个if语句,设定一个变量,当这个变量为真时显示,为假时隐藏
再在页面设一个按钮阿之类的通过激发来改变那个变量的值.

<body>
<!--
<table width="1003" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="1003" height="109" valign="top"></td>
</tr>
</table>
-->
<table width="1003" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1003" height="109" valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
</table>
<table width="1003" border="0" cellpadding="0" cellspaci