Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a simple JavaScript program in HTML file to show the table of any entered

ID: 3611736 • Letter: W

Question

Write a simple JavaScript program in HTML file to show the table of any entered number. Follow these directions for it: Use HTML form, with one text box and a button as shown below: Enter a number: Text box is to enter the number and when you press the "Have a Table" button a table of entered number should be shown. Use loop to print the table Output should be as shown below (if 5 is entered): 5 x 1 = 5 5 x 2 = 10 5 x 3 = 15 5 x 4 = 20 5 x 5 = 25 5 x 6 = 30 5 x 7 = 35 5 x 8 = 40 5 x 9 = 45 5 x 1 0 = 50

Explanation / Answer

<script>
function table()
{

if(document.form1.val.value.length>0)
{
value=document.form1.val.value
for (i=1;i<=10;i++)
  {
  document.write("<fontsize='6'>"+value+"x"+i+"="+value*i+"<br>")
  
  }

}
else alert("Please Enter Some Number")

}


</script>


</head>


<body>

<formname="form1"><label>Enter a Number:</label>

<inputname="val">

<input type="button"onclick="table()" value="Have a Table">

</form>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote