JavaScript驗證我已經做了很多驗證,但這個時候不工作我不知道如何請幫助我.. HTML
<form action="" method="post" name="contactformm" onsubmit="return valiadd()">
<div class='row'>
<div class='col-sm-4'>
<div class='form-group'>
<label for='fname'>Name</label>
<input type='text' name='namee' class='form-control' />
</div>
<div class='text-right'>
<input type='submit' class='btn btn-primary' value='Submit' />
</div>
</div>
</div>
</form>
Javascript代碼
function valiadd {
var name = document.contactformm.namee.value;
if(name==""){
alert('Please Fill Your Name');
document.contactformm.namee.focus();
return false;
}
else {
return true;
}
}