练习用php做表格

时间:2023-03-10 00:24:12
练习用php做表格
<!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>
<script language="javascript">
var bc="";
function doover(tr)
{
bc = tr.style.backgroundColor;
tr.style.backgroundColor="#FF0000";
}
function doout(tr)
{
tr.style.backgroundColor=bc;
}
</script>
</head> <body>
<table width="100%" border=0 cellpadding=3 cellspacing="1" bgcolor="black">
<?php
for($i=1;$i<=30;$i++){
if($i%2==0)
{
?>
<tr style="background-color:white;" onmouseover="doover(this)" onmouseout="doout(this)">
<?php
}
else{
?>
<tr style="background-color:yellow;" onmouseover="doover(this)" onmouseout="doout(this)">
<?php
}
?>
<td><?php echo $i ?></td>
<td><?php echo $i ?></td>
<td><?php echo $i ?></td>
</tr>
<?php
}
?>
</table>
</body>
</html>

练习用php做表格