Designed using HTML/CSS/Javascript, simple webpage just matching what is said be
ID: 3585431 • Letter: D
Question
Designed using HTML/CSS/Javascript, simple webpage just matching what is said below.
Thanks in advance
Part 2. This part contains an input field and a button “Generate times table". When the user enters an integer from 1 to 9 and clicks the button, the corresponding 2 times tables will appear side-by-side. The times table on the right must be displayed in a list as follows. When the user enters another number and click the button, the old times tables disappear and the new times tables will be generated accordingly Enter an integer from 1 to 9: 6 Generate times table 6 x 1 6 6x2=12 6x3=18 6x4=24 6 x 5 30 6 x 6 36 6x7=42 6 x 8 48 6x9=54 6 x 1 6 · 6x2=12 · 6x3=18 · 6x4=24 · 6x5=30 · 6x6=36 · 6x7=42 · 6x8=48 6 x9 54Explanation / Answer
Code:
<!DOCTYPE html>
<html>
<head>
<script>
function calc() {
var num = document.getElementById("num").value;
var i = 0;
document.write("<table>");
for(i=1;i<10;i++) {
document.write("<tr>" + "<td>" + num + " x " + i + " = " + num*i+ "</td>" + "<td>" + "<ul>"+ "<li>" + num + " x " + i + " = " + num*i + "</li>" +"</ul>"+"</td>" + "</tr>");
}
document.write("</table>");
}
</script>
</head>
<body>
<p>enter an integer from 1 to 9</p>
<input id="num" type="text" name = "name"/>
<button>generate times table</button>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.