<html>
<head>
<title>table</title>
</head>
<style>
@import url('https://fonts.googleapis.com/css2?family=Squada+One&display=swap');
td{
font-size:30px;
text-align:center;
}
body {
background-color:blue;
color:white;
letter-spacing:8px;
font-family: 'Squada One', cursive;
font-size:30px;
text-align:center;
}
table {
border-color: white;
border-width:3px;
background-color:red;
}
div{
color:white;
background-color: red;
border :2px solid white;
border-radius:10px;
}
</style>
<body>
<script>
alert("This code will take a number as input from the user and display a table ranging from 1 to the number entered by the user.");
var num=prompt("Enter the number");
if (num==null)
{
alert("Enter the number then you can see the output");
}
document.write("<div>"+"Tables From 1 to "+num+"</div>"+"<br>");
document.write("<table border=2px cellspacing=0 width=100% color='white'>");
for(a=1;a<=num;a++)
{
document.write("<tr>");
document.write("<td>");
for(b=1;b<=10;b++)
{
document.write(a+" x "+b+" = "+a*b+"<br>");
}
document.write("</td>");
document.write("</tr>");
}
document.write("</table>");
</script>
</body>
</html>
Output
Comments
Post a Comment