PHP7 TutorialThe column introduces JS verification used in message board development
function,
onsubmit,
onclick,
document.getElementsByTagName(These are commonly used in front-end development, so they must be mastered)
,
onsubmit,
xxx.click(function(){})and so on (many verification methods, you need to slowly discover in the future, the magical JS world is waiting for you);
onclickevent, in order to trigger the
checkformfunction to activate form validation; then add the
onsubmit="return false;"attribute to the form tag, in order to prevent the form table The default submission event (prevents event bubbling); look at the code specifically and try it in practice~
a, sample code snippet
functionb. To select form elements, use
document.getElementsByTagName('input')c. To prevent bubbling (prevent form submission, it must be submitted only if the verification is successful), use
return false;d, script triggers form submission using
document.feedback_form.submit();,
feedback_formis the name of the form form
< ;input type="submit" onclick="checkform()" value="Submit your message" class="sub" />
留言板_科科分享
留言板
FEEDBACK
Okay, our message board for native JS verification ends here. If you have other verification methods or have any questions, please feel free to doodle in the comment area! ~
The above is the detailed content of JS verification for PHP7 message board development. For more information, please follow other related articles on the PHP Chinese website!