0

what's wrong with this? >.<

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
	<style type="text/css">
		body {
			margin-left: 25%;
			margin-right: 25%;
		}
		h1 {
			font-family: jokerman;
			text-align: center;
		}
		td {
			border-style: outset;
			border-width: 5px;
			border-color: gray;
			font-family: courier new;
		}
	</style>
</head>
<body>
	<h1>Multiplication Table</h1>
	<br /><br /><br />
	<script type="text/javascript">
		mess = "Please enter the number of rows <1-10>."
		do {
			x = window.prompt(mess);
			x = parseInt(x);
			mess = mess + "\nInvalid entry. Please try again."
		} while (x<1 || x>10)
		
		mess2 = "Please enter the number of columns <1-10>."
		do {
			y = window.prompt(mess2);
			y = parseInt(x);
			mess2 = mess2 + "\nInvalid entry. Please try again."
		} while (y<1 || y>10)
		
		
		document.write("<table>");
		for (i=0, i<x, i++) {	
			document.write("<tr>");
			for (j=0, j<y, j++) {
				document.write("<td>", i, " * ", j, "</td>");
			}
			document.write("</tr>");
		}
		document.write("</table>");
	</script>
</body>

somebody help me please.. >.<

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by @developer
0

Try this..check whether it works for you...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
	<style type="text/css">
		body {
			margin-left: 25%;
			margin-right: 25%;
		}
		h1 {
			font-family: jokerman;
			text-align: center;
		}
		td {
			border-style: outset;
			border-width: 5px;
			border-color: gray;
			font-family: courier new;
		}
	</style>
</head>
<body>
	<h1>Multiplication Table</h1>
	<br /><br /><br />
	<script type="text/javascript">
		mess = "Please enter the number of rows <1-10>."
		do {
			x = window.prompt(mess);
			x = parseInt(x);
			mess = mess + "\nInvalid entry. Please try again."
		} while (x<1 || x>10)
		
		mess2 = "Please enter the number of columns <1-10>."
		do {
			y = window.prompt(mess2);
			y = parseInt(y);
			mess2 = mess2 + "\nInvalid entry. Please try again."
		} while (y<1 || y>10)
		
	
		document.write("<table>");
		for (i=0; i<x; i++) {	
			document.write("<tr>");
			for (j=0; j<y; j++) {
				document.write("<td>", i, " * ", j, "</td>");
			}
			document.write("</tr>");
		}
		document.write("</table>");
	</script>
</body>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.