Javascript form programming:
1. How to find form elements:
1.var oForm=document.getElementById("Form1");
2.var oForm=document.forms[Form1]//Find by name;
2. Common characteristics of form fields:
disabled: This property is used to indicate whether a form control is available;
form attribute: This attribute returns a form containing fields;
blur(): This method causes the form field to lose focus;
focus(): This method causes the form field to gain focus;
blur event: When the form field loses focus, the event occurs, and the onblur event handler is then executed;
focus event: When the form field gets focus, the event occurs, and the onfocus event handler is then executed;
Three: Form submission, reset
sumbit: oForm sumbit();
reset: oForm reset();
4. Get the value of the text box:
length foxt.value.length;
Five: Add element nodes, text nodes, and delete elements
creatElement, creatTextNode, remove;
Six: Select the value of the check box: select
Seven: Form verification best practices:
Must be helpful to the user;
Don't be annoying;
Use HTML functions instead of Javascript whenever possible
Show all errors at once;
Catch errors early;
If you are not sure, don’t be too strict;