]
js verification is Positive integer
The code is as follows:
<script> <br> var re = /^[1-9]d*$/; //Intelligent verification of single characters<br>if (!re.test(document.getElementById('group_order').value)){ <br>alert(" Group order must be numeric!"); <br>document.getElementById('group_order').focus(); <br>return false; <br>} <br></script>
if(value < ;0 || value!=parseInt(value) ){
alert("is not a positive integer");
}else{
alert("is a positive integer");
}
JS sending form (method 1): check_input is a js function, but this method will send all the forms in the page The code is as follows:
<% form_tag( {:controller=>"transaction",:action=>"check_cid"}, {:name=>"form1",:method=>"post",:multipart=>"true" ,:onsubmit=>”return check_input();”}) do %>
< ;% end %>
JS sending form (method 2): check_original is a js function. This method will send the specified form. Regardless of method 1 or method 2, don’t forget to add return
The code is as follows:
<%= form_tag({:controller=>" program",:action=>"index"},{:name=>"newform",:method=>"post",:multipart=>"true"}) %>
< %= submit_tag "Add",{:name=>'newgroup',:onclick=>'return check_original();'} %>
<%= form_tag %>
To be continued............
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn