write rhe program in java script to create a table of 5
Answers
Answer:
5*1=5
5*2=10
5*3=15
5*4=20
5*5=25
5*6=30
5*7=35
5*8=40
5*9=45
5*10=50
Answer:
JavaScript function
<html>
<head>
<title>To display Table of an entered Number.</title>
<script type="text/javascript">
function printTable()
{
var num;
num=Number(document.getElementById('txtNumber').value);
for(var i=1; i<=10; i++)
{
var pTag= document.getElementById('pPrint');
pTag.innerHTML += (num*i) + "<br/>"
}
}
</script>
</head>
<body style="text-align: center;">
<h1>To Display Table of an entered Number.</h1>
<p><input type="text" id="txtNumber" placeholder="Put the number 5"/></p>
<p><input type="button" value="Print Table of 5." onclick='printTable()'/>
<!--print numbers-->
<p id="pPrint"></p>
</body>
</html>