ASDV-WebDev/Semester 1/Chapter ZIPs/JavaScript/ch7/ex_7_17.html

36 lines
1.0 KiB
HTML

<html>
<head>
<title>Example 7.17</title>
<link href="carla.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="mySource.js"></script>
<script>
function buildIt()
{
var numRows; var numCols; var table;
var filler; var filename;
numRows = parseInt(prompt("How many rows do you want in your table?"));
numCols = parseInt(prompt("How many columns do you want in your table?"));
filler = prompt("Do you want to leave the table cells empty? Type y for yes, n for no.");
if (filler == "y")
filler = "empty";
else
{
filler = prompt("Do you want the cells filled with random numbers? Type y for yes, n for no");
if (filler == "y")
filler = "random";
else
filler = "prompt";
}
filename = prompt("Enter the filename of the style sheet to use with this table:");
table = buildTable(numRows, numCols, filler, filename);
}
</script>
</head>
<body>
<div id="container">
<h1 id="logo">Table Builder</h1>
<p><input type ="button" onclick="buildIt()" value = "Build a table"></p>
</div>
</body>
</html>