資料結構第1章
HTML架構與TABLE
<HTML> <!-- HTML開始 -->
<HEAD> <!-- HEAD(頭部)開始 -->
<TITLE>我的第一個HTML程式</TITLE> <!-- 標題 -->
</HEAD> <!-- HEAD(頭部)結束 -->
<BODY> <!-- BODY(身體)開始 -->
<P>Hello world!
</BODY> <!-- BODY(身體)結束 -->
</HTML> <!-- HTML結束 -->
// 改成PHP
<?php
echo "<HTML>"; // HTML開始
echo "<HEAD>" // HEAD(頭部)開始
echo "<TITLE>我的第一個HTML程式</TITLE>";
echo "</HEAD>"; // HEAD(頭部)結束
echo "<BODY>"; // BODY(身體)開始
echo "<P>Hello world!";
echo "</BODY>" // BODY(身體)結束
echo "</HTML>"; // HTML結束
?>
HTML TABLE 語法
<table ...> .... </table>
SUMMARY=Text (purpose/structure of table)
- WIDTH=Length (table width)
- BORDER=Pixels (border width)
- FRAME=[ void | above | below | hsides | lhs | rhs | vsides | box | border ] (outer border)
- RULES=[ none | groups | rows | cols | all ] (inner borders)
- CELLSPACING=Length (spacing between cells)
- CELLPADDING=Length (spacing within cells)
- ALIGN=[ left | center | right ] (table alignment)
- BGCOLOR=Color (table background color)
<!-- HTML版 範例-->
<html>
<body>
<center>
<table border=1 cellpadding=1 cellspacing=1>
<!-- border=邊界 border=0 無邊界 -->
<!-- cellpadding 儲存格邊界 -->
<!-- cellspacing 儲存格間距 -->
<caption>公佈欄</caption>
<tr>
<td>第一列第一行</td>
<td>第一列第二行</td>
</tr>
<tr>
<td>第二列第一行</td>
<td>第二列第二行</td>
</tr>
</center>
</table>
</body>
</html>
// PHP版
<?php
echo "<html>";
echo "<body><center>";
echo "<table border=1 cellpadding=1 cellspacing=1>
<caption>公佈欄</caption>";
echo "<tr> <td>第一列第一行</td>";
echo "<td>第一列第二行</td>";
echo "</tr>";
echo "<tr><td>第二列第一行</td>";
echo "<td>第二列第二行</td>";
echo "</tr>";
echo "</table>";
echo "</center></body>";
echo "</html>";
?>
作業: 撰寫PHP程式,利用HTML Table 展示9*9乘法表