Method 1,
function CheckForm() {
if (document.form1.trainingName.value==""){
; );
return false; 🎜> Copy the code
The code is as follows:
function CheckForm() {
var classLevel = $("#classLevel").val(); var re = /^[1-9][0-9]*$/;
if(!re.test( classLevel)&&classLevel.length>0){
alert("Please enter an integer greater than zero!"); > } }