2012-12-06 27 views
0

我有一個表單用作測驗來收集答案,並且是動態生成的,因此問題的數量是可變的。 我希望能夠計算for中的單選按鈕組的數量,以便a)確定哪些地方已選中,b)能夠收集它們,以便將所選答案保存在數據庫中。 這是我應該嘗試在jQuery中做什麼,並以某種方式將它傳遞給VBScript,或者這可以在VBScript中以編程方式完成? 作爲參考,下面是一個例子形式生成的HTML:VBScript計算表格中的特定元素

<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> 

回答

1

客戶端VBScript是隻能在Internet Explorer使用。你必須使用JavaScript(jQuery JavaScript)。

+0

我想出了一個數組來保持答案,其中正是我想要的。感謝有關客戶端VBScript的信息。 – stephmoreland