[英]form action and sumbit button onclick function are not working together
<form name="payform" method="POST">
<input style="display:none" id="txnid" name="txnid" ng-model="transactionid" />
<input style="display:none" id="productinfo" name="productinfo" value="bill payment" />
<input style="display:none" id="mobileNumber" name="phone" ng-model="mobileNumber" />
<input id="buttonPay" type="submit" class="mdl-button" value="SUBMIT" onclick="prePay()" >
</form>
my html code looks like this. 我的html代码看起来像这样。 i have to post the contents of textboxes to pay.jsp file.
我必须将文本框的内容发布到pay.jsp文件中。 and i have to perform some additional operations on the submit button's onclick event.
而且我必须对“提交”按钮的onclick事件执行一些其他操作。
prePay=function(){
...
...
...
document.getElementById("payform").action = "/pay.jsp";
document.forms["payform"].submit();
}
but when i click submit button the onclick function is not working. 但是当我单击提交按钮时,onclick功能不起作用。 just redirecting to the page
只是重定向到页面
You use getElementById
. 您使用
getElementById
。 Your form
doesn't have id
, it has only name
. 您的
form
没有id
,只有name
。 Try add id="payform"
to form
tag. 尝试将
id="payform"
添加到form
标签。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.