0

我正在使用以下 javascript 提交表单,但它没有提交。

 if(timeup)
        {
         alert("welcome to time up.");
        var id = document.getElementById("test_id").value;
        var no = document.getElementById("noq").value;
      var action = 'result.php?id='+id+'&no='+no+'';

    exercisenew.action = action;
    alert("form"+exercisenew.action);
   exercisenew.submit();
       alert("form submitted.");
    }

完整代码在这里

html格式。

<form method="post" action="" id="exercisenew" name="exercisenew">
4

2 回答 2

1
if(timeup)
{
  alert("welcome to time up.");
  var id = document.getElementById("test_id").value;
  var no = document.getElementById("noq").value;

  //use encodeURIComponent()
  var action = encodeURIComponent('result.php?id='+id+'&no='+no+'');

  //get the form
  var exercisenew = document.getElementById("exercisenew")
  exercisenew.action = action;

  alert("form"+exercisenew.action);
  exercisenew.submit();
  alert("form submitted.");
}
于 2013-02-13T06:05:52.420 回答
0

exercisenew

var exercisenew = document.getElementById("exercisenew")

做你做过的所有事情

于 2013-02-13T06:04:55.420 回答