<!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>Untitled Document</title>
</head>
<body>
<?php
$rows = 1;
$columns = 1;
$cells = 1;
?>
<?php $rows = (int) $_POST["totalBaris"]; ?>
<?php $columns = (int) $_POST["totalKolom"]; ?>
<?php $cells = (int) $_POST["totalSel"]; ?>
jumlah baris anda <?php echo $rows; ?> baris,<br />
jumlah kolom anda <?php echo $columns; ?> kolom,<br />
jumlah sel anda <?php echo $cells; ?> sel,<br />
<br /><br />
<?php
$width = $columns * 75;
echo "<table width=".$width." border=1>";
$rw = 0;
$cel = 1;
while ($rw < $rows && $cel <= $cells)
{
echo "<tr>";
$cl = 0;
while ($cl < $columns)
{
if ($cel <= $cells)
{
echo "<td><div align=center>".$cel."</div></td>";
$cel++;
}
$cl++;
}
echo "</tr>";
$rw++;
}
echo "</table>";
?>
</body>
</html>
script html :
<!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>Untitled Document</title>
</head>
<body background="gambar presentasi/___Baby_O____by_turp.jpg">
<form method="post" action="tabel.php">
<p><font face="Bauhaus 93" color="#336699" size="5"><strong>program bikin *****tabel***** ajaib</strong></font><br></p>
<table width="277" border="0">
<tr>
<td width="89">Baris</td>
<td width="172"><strong>: </strong><input name="totalBaris" type="text" id="totalBaris" onKeyUp="getmax();" onfocus="this.select();"></td>
</tr>
<tr>
<td><label>Kolom</label></td>
<td><strong>: </strong><input name="totalKolom" type="text" id="totalKolom" onKeyUp="getmax();" onfocus="this.select();"></td>
</tr>
<tr>
<td>Sel</td>
<td><strong>: </strong><input name="totalSel" type="text" id="totalSel" onKeyUp="getmax();" onFocus="this.select();"></td>
</tr>
<tr>
<td>Sel Maksimal</td>
<td><strong>: </strong><input name="jmlSelMax" type="text" id="jmlSelMax" readonly="true" style="background-color:#999999">
</td>
</tr>
<tr>
<td>
<div align="center">
<br />
<input type="reset" name="Reset" value="bersihkan">
</div></td>
<td>
<div align="right">
<br />
<input type="submit" name="Generate" value="bikin">
</div></td>
</tr>
</table>
</form>
<script language="JavaScript" type="text/javascript">
<!--
function getmax() {
var R = parseInt(document.getElementById('totalBaris').value);
var C = parseInt(document.getElementById('totalKolom').value);
var X = parseInt(document.getElementById('totalSel').value);
var cellmax = document.getElementById('jmlSelMax');
var total = 0;
total = R * C;
cellmax.value = new String(total);
if (X > total)
{
alert('Jumlah sel yang anda inginkan melewati batas maksimal sel =' + total);
document.getElementById('totalSel').value = new String();
}
}
//-->
</script>
</body>
</html>
output :
Tidak ada komentar:
Posting Komentar