提交表单时使用参数传递函数

时间:2015-01-06 18:41:06

标签: javascript

我有一个基本上是多项选择测验的表格。单击提交按钮后,我想运行一个javascript函数。此函数有两个参数:formID和answerID

<form id="Question1" onsubmit="multipleChoice(formID,answerID)">    
    <fieldset>
          <input type = "radio"
                 name = "Question1"
                 id = "Question1-a"
                 value = "answer 1" />
          <label for = "Question1-a">A&#41; answer 1</label>
          <br>
          .... other possible answers
      </fieldset> 
      <button type="submit">Submit</button> <!-- on submit, return the form ID and the answer ID that the user chose (e.g., (Question1,Question1-a)) -->
</form>

我想提取用户提交的答案的ID,并将其放在第二个参数和表单的ID中,并将其放在第一个参数中。这可能不使用php而只使用javascript / jquery吗?

0 个答案:

没有答案