我有一個表格有從我必須爲每一個輸入多個ID和姓名輸入和元素
我怎樣才能防止這種類型的ID和用戶名參加考試的數百個輸入和元素? 有沒有解決方案的JavaScript?
<ol>
<li>
<div class="qselections">
<input type="radio" value="1" id="1" name="question1"><label for="1">1</label>
<input type="radio" value="2" id="2" name="question1"><label for="2">2</label>
<input type="radio" value="3" id="3" name="question1"><label for="3">3</label>
<input type="radio" value="4" id="4" name="question1"><label for="4">4</label>
</div>
</li>
<br>
<li>
<div class="qselections">
<input type="radio" value="1" id="5" name="question2"><label for="5">1</label>
<input type="radio" value="2" id="6" name="question2"><label for="6">2</label>
<input type="radio" value="3" id="7" name="question2"><label for="7">3</label>
<input type="radio" value="4" id="8" name="question2"><label for="8">4</label>
</div>
</li>
<br>
.
.
.
.
.
<li>
<div class="qselections">
<input type="radio" value="1" id="1197" name="question300"><label for="1197">1</label>
<input type="radio" value="2" id="1198" name="question300"><label for="1198">2</label>
<input type="radio" value="3" id="1199" name="question300"><label for="1199">3</label>
<input type="radio" value="4" id="1200" name="question300"><label for="1200">4</label>
</div>
</li>
<br>
</ol>
不,你必須手工鍵入的一切,一個ID不能只是一個數字,你的情況應該是至少50個字符長,併爲每個元素完全獨特.... .......或者,您可以使用一種可以在循環中生成元素的服務器端語言。 – adeneo