web表格代码(5)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<script type+"text/javascript">
var str='<table border="1 ">';
for(var i=0;i<3;i++ )
{str+="<tr>"
for(var j=1;j<4;j++)
{str+="<td>"+(i*3+j)+"</td>"
}
str+="<t/r>";}
str+='</table>';
document.write(str)
</script>
<body>
<html>

<body>

<h4>表头:</h4>
<table border="1">
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
</table>

<h4>垂直的表头:</h4>
<table border="1">
<tr>
<th>姓名</th>
<td>Bill Gates</td>
</tr>
<tr>
<th>电话</th>
<td>555 77 854</td>
</tr>
<tr>
<th>电话</th>
<td>555 77 855</td>
</tr>
</table>

</body>
</html>

</body>
</html>

posted @ 2016-03-24 19:50  吃货大坦克  阅读(775)  评论(0编辑  收藏  举报