HTML DOM width ÊôÐÔ

¶¨ÒåºÍÓ÷¨

width ÊôÐÔ¿ÉÉèÖûò·µ»Ø±í¸ñµÄ¿í¶È¡£

Óï·¨

tableObject.width=percent|pixels

ʵÀý

ÏÂÃæµÄÀý×ӿɸü¸Ä±í¸ñµÄ¿í¶È£º

<html>
<head>
<script type="text/javascript">
function changeWidth()
  {
  document.getElementById("table1").width="100%";
  }
</script>
</head>
<body>

<table id="table1" border="1">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick=changeWidth()
value="Change table width" />
</body>
</html>
VUE