1.1 Use JS to complete the registration page form prompt and check 1.1.1 requirements:
Registering the page before it is a popup dialog is not particularly friendly in the form of a check! You can display the error message after the text box. And when the cursor falls into the text box, the message prompts.
1.1.2 Analysis: 1.1.2.1 Technical Analysis:
"JS Output"
- document.getElementById (""). Innerhtml= "HTML code";
- document.write ("");
"JS Event"
- Onfocus: Get focus.
- Onblur: Lose focus.
OnSubmit: At the time of submission.
1.1.2.2 Step Analysis:
"Step One" creates an HTML document
Step two adds an event to the text box you want to check.
"Step three" trigger function
Step four writes the contents of a hint to the area of the HTML after the text box in the function.
1.1.3 Code implementation:
function Tips (id,content) {document.getElementById (id+ "Span"). InnerHTML = "<font color= ' red ' > "+content+" </font> "; } function Checkform () {//To determine that the user name cannot be empty: Var Usernam E = document.getElementById ("username"). Value; if (username = = "") {document.getElementById ("Usernamespan"). InnerHTML = "<font color = ' Red ' > username cannot be empty! </font> "; return false; } var password = document.getElementById ("password"). Value; if (password = = "") {document.getElementById ("Passwordspan"). InnerHTML = "<font color = ' Red ' > Password cannot be empty! </font> "; return false; }}1.1.4 Summary: Summary of the events of 1.1.4.1 JS:
- OnLoad:
- OnClick:
- OnSubmit:
- Onfocus:
- Onblur:
- OnChange: The drop-down list changes the event.
- OnDblClick: Double-click an element's event.
Keyboard Manipulation Events:
- OnKeyDown:
- OnKeyUp:
- onkeypress
Mouse Action Events:
- OnMouseMove
- onmouseout:
- onmouseover
- OnMouseDown
- OnMouseUp
Javaweb03-html Notes (iv)