<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="./script.js"></script>
</head>
<body>
<h1>multiplication table</h1>
<input type="number" id="number"/><button onclick="gugudan()">출력</button>
<div id="answer"></div>
</body>
</html>
<Script>
function gugudan(){
let number = parseInt(document.getElementById('number').value);
let answer = document.getElementById('answer');
answer.innerHTML = '';
for(let i = 1; i<=9; i++){
let line = document.createElement('p');
line.textContent += `${number} X ${i} = ${number*i}`
answer.appendChild(line);
</script>
}
}