我有一个表格,它被用作收集答案的测验,并且是动态生成的,因此问题的数量是可变的。我希望能够计算 for 中的单选按钮组的数量,以便我可以 a)确定检查的位置和 b)能够收集它们,以便我可以将选定的答案保存在数据库中。这是我应该尝试在 jQuery 中做的事情并以某种方式将其传递给 VBScript 还是可以在 VBScript 中以编程方式完成?作为参考,这是为示例表单生成的 HTML:
<form id="vms_quiz" method="post">
<h2>Sustainable Infrastructure Quiz 1</h2>
<p>Phasellus ultrices nulla quis nibh. Quisque a lectus. Donec consectetuer ligula vulputate sem tristique cursus. Nam nulla quam, gravida non, commodo a, sodales sit amet, nisi.</p>
<!-- START QUESTION GROUP: Question #1 -->
<h2>Question #1</h2>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
<label>
<input type="radio" name="Q_1" value="0" id="Q1C_1" akey="0" checked="false">
Who</label>
<label>
<input type="radio" name="Q_1" value="0" id="Q1C_2" akey="0" checked="false">
What</label>
<label>
<input type="radio" name="Q_1" value="1" id="Q1C_3" akey="1" checked="false">
Where</label>
<label>
<input type="radio" name="Q_1" value="0" id="Q1C_4" akey="0" checked="false">
When</label>
<label>
<input type="radio" name="Q_1" value="0" id="Q1C_5" akey="0" checked="false">
Why</label>
<!-- START QUESTION GROUP: Question #2 -->
<h2>Question #2</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
<label>
<input type="radio" name="Q_2" value="0" id="Q2C_6" akey="0" checked="false">
Who</label>
<label>
<input type="radio" name="Q_2" value="0" id="Q2C_7" akey="0" checked="false">
What</label>
<label>
<input type="radio" name="Q_2" value="1" id="Q2C_8" akey="1" checked="false">
Where</label>
<label>
<input type="radio" name="Q_2" value="0" id="Q2C_9" akey="0" checked="false">
When</label>
<label>
<input type="radio" name="Q_2" value="0" id="Q2C_10" akey="0" checked="false">
Why</label>
<!-- START QUESTION GROUP: Question #3 -->
<h2>Question #3</h2>
<p>Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed.</p>
<label>
<input type="radio" name="Q_3" value="0" id="Q3C_11" akey="0" checked="false">
Who</label>
<label>
<input type="radio" name="Q_3" value="0" id="Q3C_12" akey="0" checked="false">
What</label>
<label>
<input type="radio" name="Q_3" value="1" id="Q3C_13" akey="1" checked="false">
Where</label>
<label>
<input type="radio" name="Q_3" value="0" id="Q3C_14" akey="0" checked="false">
When</label>
<label>
<input type="radio" name="Q_3" value="0" id="Q3C_15" akey="0" checked="false">
Why</label>
<input name="vms_quizID" type="hidden" value="1">
<input name="vms_videoID" type="hidden" value="1">
<div class="frm_div">
<input id="btn_quiz_check_answers" name="btn_quiz_check_answers" type="submit" value="Check Answers">
</div>