<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>表格生成器&乘法表</title>
<style>
table{
background:#F00;
/*border-collapse: collapse;*/
border-spacing: 1px;
margin-top: 20px;
}
table td{ background:#FFF;
padding: 3px;
}
.box{
margin-top: 30px;
line-height: 24px;
}
.line{
overflow: hidden;
}
.column{
width: 80px;
float: left;
padding:6px;
border-right: 1px solid #f00;
border-left: 1px solid #f00;
border-top: 1px solid #f00;
}
.columnbottom{
border-bottom: 1px solid #f00;
}
.columnleft{
border-left: none;
}
</style>
</head>
<body>
<form mathod='GET' action='<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>'>
请选择:<input type="text" name="row" >行<input type="text" name="col" >列
<input type="submit" name="submit" value="提交">
</form>
</body>
</html>
<?php
header("Content-type:text/html charset=utf-8");
$row = $col = '';
$row = $_GET["row"];
$col = $_GET["col"];
// echo '---------'.$row;
echo "<table>";
for($i=0;$i<$row;$i++){
echo '<tr>';
for($j=0;$j<$col;$j++){
echo '<td>'.($i*$col+$j).'</td>';
}
echo '</tr>';
}
echo "</table>";
echo "<div>";
for($i=0;$i<10;$i++){
echo '<div>';
if($i!=9){
for($j=1;$j<$i+1;$j++){
if($j==1){
echo '<div >'.($i).'x'.($j).'='.($i*$j).'</div>';
}else{
echo '<div class="column columnleft" >'.($i).'x'.($j).'='.($i*$j).'</div>';
}
}
}else{
for($j=1;$j<$i+1;$j++){
if($j==1){
echo '<div class="column columnbottom" >'.($i).'x'.($j).'='.($i*$j).'</div>';
}else{
echo '<div class="column columnbottom columnleft" >'.($i).'x'.($j).'='.($i*$j).'</div>';
}
}
}
echo '</div>';
}
echo "</div>";
?>
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!