How To Create Multiplication Table In Javascript
In This Javascript Tutorial we will see How To Make A Multiplication Table With HTML Table Using JS In Netbeans Editor .
Project Source Code:
<!DOCTYPE html>
<html>
<head>
<title>Javascript Multiplication Table</title>
<meta charset="windows-1252">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<script>
document.write("<table border='1px'>");
document.write("<tr style='font-size:30px;color:#fff;background-color:#000;'>");
for(i = 1; i < 11; i++)
{
document.write("<th> [ " + i + " ]</th>");
}
document.write("</tr>");
for(k = 1; k<11; k++)
{
var colorCode = "";
if(k%2 === 0)
{
colorCode = "#eee";
}else{
colorCode = "#99e265";
}
document.write("<tr style='background-color:"+ colorCode +"'>");
for(j= 1; j< 11; j++)
{
document.write("<td style='font-size:23px;'>"+j+" X "+ k + " = " + j*k + "</td>")
}
document.write("</tr>");
}
document.write("</table>");
</script>
</body>
</html>