html
html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<div class="in">
<form >
<input id="inpt" type="text" placeholder="enter table number">
<button onclick="printTable()" id="btn">Print</button>
</form>
</div>
<div id="out">hey</div>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
body {
}
.in{
margin: 10px auto;
height:80px;
width:300px;
text-align:center ;
background-color: wheat;
}
#inpt,#btn{
position:relative ;
top:20px;
height:30px;
}
Enter to Rename, Shift+Enter to Preview
js
js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function printTable(){
var tableOfNumber = document .getElementById ("inpt").value;
var saveDataAsString ="";
for (var i =1; i!=10;i++)
{
saveDataAsString = tableOfNumber *i;
alert (saveDataAsString );
document .getElementById ("out").innerHTML = document .getElementById ("out").innerHTML +"<br>"+saveDataAsString;
}
}
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run