好的,所以我有 2 个数组,我必须在 html javascript 中添加一个 gui,这将允许用户输入一个新的国家和人口,并有一个按钮可以将新元素添加到数组中。我怎样才能做到这一点?
<head>
<title></title>
<script type="text/javascript">
var countries = new Array();
countries[0] = "Nigeria";
countries[1] = "Irag";
countries[2] = "Philippines";
countries[3] = "Indonesia";
countries[4] = "Egypt";
countries[5] = "Russia";
countries[6] = "Vietnam";
countries[7] = "Ethiopia";
countries[8] = "Mexico";
var population = new Array();
population[0] = "166,629,000";
population[1] = "33,330,000";
population[2] = "92,337,000";
population[3] = "237,641,000";
population[4] = "82,940,000";
population[5] = "143,300,000";
population[6] = "87,840,000";
population[7] = "84,320,000";
population[8] = "112,336,000";
</script>