Em định tạo một web site học từ vựng mà làm đến đây bị đứng. Mỗi lần thêm phần tử thì array lại reset lại từ đầu thay vì push thêm từ vựng vào mọi người giúp em với
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Nhựt Duy</title>
<style>
div#the{
margin: auto;
text-align: center;
}
table{
text-align: center;
margin: auto;
}
.tv {
width: 100%;
height: 50px;
font-size: 180%;
text-align: center;
}
.nhap{
width: 50px;
height: 50px;
}
.hoc{
width: 100px;
height: 50px;
}
</style>
<script>
window.onload = function(){
var nhap = document.getElementById("nhap");
nhap.onclick = xuly;
}
function xuly(){
var tuvung = document.getElementById("tuvung").value;
tuvung1 = [];
tuvung1.push(tuvung);
tuvung.value="";
}
</script>
</head>
<body>
<div id="the">
<h1>Học Từ Vựng</h1></br>
<form>
<table >
<tr>
<td>
<input type="text" id="tuvung" class="tv"/>
</td>
<td>
<input type="button" id="nhap" value="Nhập" class="nhap"/>
</td>
</tr>
<tr>
<td>
<input type="button" id="hoc" value="Học" class="hoc"/>
</td>
</tr>
</table>
</form>
</div>
</body>