如何添加文本框作爲2d數組的輸入?我有文本框作爲表單。將每個學生的輸入分配給座位的最簡單方法是什麼? 編輯:我需要把document.getElementById(seat1).innerhtml放入函數中嗎?javascript - 如何將文本框添加到2d數組
<form id="studentForm">
<input type="text" name="student1" id="myInput1">
<input type="text" name="student2" id="myInput2">
<input type="text" name="student3" id="myInput3"><br>
<input type="text" name="student4" id="myInput4">
<input type="text" name="student5" id="myInput5">
<input type="text" name="student6" id="myInput6"><br>
<input type="text" name="student7" id="myInput7">
<input type="text" name="student8" id="myInput8">
<input type="text" name="student9" id="myInput9"><br>
</form>
<script type="text/javascript">
function myFunction() {
var seat = onearray(3)
seat[1] = onearray(3)
seat[1][1]
seat[1][2]
seat[1][3]
seat[2] = onearray(3)
seat[2][1]
seat[2][2]
seat[2][3]
seat[3] = onearray(3)
seat[3][1]
seat[3][2]
seat[3][3]
}
</script>
<label for="Seat1">Seat 1 </label>
<p id="seat1"></p>
<label for="Seat2">Seat 2 </label>
<p id="seat2"></p>
<label for="Seat3">Seat 3 </label>
<p id="seat3"></p>
<br>
<label for="Seat4">Seat 4 </label>
<p id="seat4"></p>
<label for="Seat5">Seat 5 </label>
<p id="seat5"></p>
<label for="Seat6">Seat 6 </label>
<p id="seat6"></p>
<br>
<label for="Seat7">Seat 7 </label>
<p id="seat7"></p>
<label for="Seat8">Seat 8 </label>
<p id="seat8"></p>
<label for="Seat9">Seat 9 </label>
<p id="seat9"></p>
你想在電腦自動安排座位和學生,或者你想給學生選擇席位他們自己,他們想要保留? –
我希望它能像座老師一樣制定座位計劃,並且能夠爲每個學生設置座位,而且我將需要在這個東西中放置一些東西,我遺漏了 –