JavaScript features
Scripting language, object-based, simple, dynamic, cross-platform
Code written position
a) prepared in the HTML <script> tag
b) write in an external .js file. Then the script tag is introduced by
JavaScript event-driven
c) user events: User actions, such as clicking, move the mouse, the mouse out, etc.
d) the system event: event triggered by the system, such as a document has finished loading.
e) common events:
- onload
- onclick click event
- onblur
- focus onfocus event
- onmouseover
- onMouseOut
Query element
Features |
API |
return value |
According to the id value queries |
document.getElementById(“id值”) |
A specific element node |
According to the label name queries |
document.getElementsByTagName ( "tag name") |
Array element node |
According to the query name attribute value |
document.getElementsByName(“name值”) |
Array element node |
JavaScript click event case HTML page (click on the pop)
JavaScript focus incident case (click left blank) HTML page
JQuery test whether the import was successful
jQuery click event case HTML page
HTML page using jQuery validate the user name format
Empty the login page error message when you log
Login page using JavaScript / jQuery check is not empty
Registration page using JavaScript / jQuery check format (regular)
(Focus) verify the registration information into the database
The first step in writing Dao interfaces (query whether the same user name, write two interfaces)
The second step to achieve Dao interfaces (write sql)
The third step test (test sql function is normal)
The fourth step to create a servlet (registration page to get data transmitted, the incoming Dao implementation class, judge)
The fifth step to submit the address (in general is the class name) where the address written servlet registration page
Important considerations 1:
1. On page servlet written request domain as an error message
2. regist page request call this domain
3. focus time writing code in JavaScript / jQuery (ie clicking the input box error disappears)
Important considerations 2:
1. Servlet class "error" is forwarded, the forwarding code is
request.getRequestDispatcher().forward(request, response);
Forwarding is performed in the server is, you do not need to add the name of the project, only to launch a request
2. In the Servlet class in the "right" is to redirect, redirect code
response.sendRedirect()
Redirection is done at the front end, you need to add the name of the project, it needs to be initiated two requests