在新选项卡(或窗口)中打开提交,并在for循环中替换此选项卡的内容

时间:2013-07-18 21:59:08

标签: javascript xhtml

以下HTML文档包含应由脚本提交的表单。文本字段的值最初设置为50000,表单在新窗口中提交,脚本STOPS,但这不是我想要的;我希望脚本打开50000的新窗口,然后对50001,50002,...,55000执行相同的操作,当然在同一个打开的窗口中

<html>
<head>
<script type="text/javascript">
function now(){
for (i=50000;i<=55000;i++){
document.getElementById("candidate_id").value=i;
document.forms["here"].submit();
}
}
</script>
</head>
<body onload="now()">
<form accept-charset="UTF-8" action="http://www.naharnet.com/examresults" method="post" target="_blank" id="here" name="here">
<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="authenticity_token" type="hidden" value="ksuw0r4TRM80q1Sw+dBoYRSrw7tfxmjLpVIVyqJnnhs=" /></div>
            <div class="row">
              <h5 id="category">Exam Category</h5>
                <select id="exam_category" name="exam_category">
              <option value="SG">SG </option>
              <option value="SV"> SV </option>
              <option value="SE">SE</option>
              <option value="LH">LH</option>
              <option value="BR">BR</option></select>
            </div>

             <div id="padding">
                <h5 id="cand_num">Candidate #</h5>
                <input id="candidate_id" maxlength="5" name="candidate_id" type="text"/>
             </div>


          <div id="padding">

            <input class="search_btn" name="commit" type="submit" value="Search"/>

         </div>


</form> 

</body></html>

0 个答案:

没有答案