如何将函数var传递给表单输入type = hidden

时间:2019-06-06 22:08:59

标签: function input var onsubmit

我必须发送基于所选无线电选择的网址。如果选择了单选按钮A,则需要使用urlA;如果选择了选单B,则需要使用urlB。

<html>
<head>

<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.min.js"></script>
<script type="text/javascript">
var stpurl;
   function getSTPname(){
       <!-- Get the correct second STP name -->
       var stpname = document.getElementById('JrC').value;
       if(!stpname){
         var stpurl='/DCPS Departments/Quick Reports/Stored Processes/Quick Reports sp;';
         return stpurl;
       }
       else{
         var stpurl='/DCPS Departments/Quick Reports/Stored Processes/QR Scorecards sp;';
         return stpurl;
       }
   }
</script>
</head>

<body>
<FORM ACTION='&_URL' target='_blank' onsubmit='getSTPname()'>
<INPUT TYPE='HIDDEN' NAME='_program' VALUE=stpurl>

<input type='radio' name='report_01' value='ScoreCard' id='JrC'>Score Card by Grade Level:<br>
<input type='radio' name='report_01' value='ACH'       id='ach'>Proficiency Denominator - Student List:<br>
<input type='submit'>


<input id="Name" type="textbox" value=stpurl>

</form>
</body>
</html>

当选择id =“ JrC”时,我需要stpurl ='/ DCPS部门/快速报告/存储的过程/ QR记分卡sp;'

否则return stpurl ='/ DCPS部门/快速报告/存储的过程/ QR报告sp;'

0 个答案:

没有答案