Sunday, 15 September 2024

WRITE A JAVASCRIPT TO PRINT MULTIPLICATION TABLE

 






CODE :-

<html>

<head>

<title>Multiplication Table</title>

<style type="text/css">

body{

background-color:lightgreen;

}

.v1{

text-align:center;

}

.tab{

background-color:lightblue;

text-transform:capitalize;

}

.v2{

text-align:center;

text-transform:capitalize;

background-color:lightgrey;

color:red;

}

</style>

<script type="text/javascript">

function check()

{

var no=document.form1.mul.value;

var i;

for(i=1;i<=10;i++)

{

document.write(no+"*"+i+"="+(no*i)+"<br>");

}

}

</script>

</head>

<body>

<center>

<form name="form1" method="post" onsubmit="return check()">

<table class="tab" border="1" cellspacing="0">

<tr class="v2">

<th colspan="2"><h4>to print multiplication table</h4></th>

</tr>

<tr>

<th>enter number:-</th>

<td><input type="text" name="mul" size="5" style="border-radius:10px;"></td>

</tr>

<tr class="v1">

<td colspan="2">

<input type="submit" name="submit" value="Submit" style="border-radius:10px;background-color:yellow;border-color:white;">

<input type="reset" name="reset" value="Reset" style="border-radius:10px;background-color:yellow;border-color:white;">

</td>

</tr>

</table>

</form>

</center>

</body>

</html>


No comments:

Post a Comment