- Three ways to use <script></script>:
- Put in the <body>
- Put in the
- Placed in an external JS file
- Three ways to output data:
- Use the document.write () method to write content to an HTML document.
- Use the Window.alert () pop-up warning box.
- Writes to an HTML element using InnerHTML.
- Use the ID property to identify the HTML element.
- Use the document.getElementById (ID) method to access HTML elements.
- Use innerHTML to get or insert element content.
- The login page prepares:
- Add an Error prompt box.
- Write a good html+css file.
- Set the ID of each INPUT element
- Defines a JavaScript function.
- Verify user name 6-20-bit
- Verify password 6-20-bit
- The onclick invokes this function.
<! DOCTYPE html>
function Fnlogin () { var ouname = document.getElementById ("uname") var oupass = document.getElementById ("UPass ") var oerror = document.getElementById (" Error_box ") if (OUname.value.length > 20 | | OUname.value.length < 6) { oerror.innerhtml = "User name 6-20-bit character" } if (OUpass.value.length > 20 | | OUpass.value.length < 6) { oerror.innerhtml = "Password is 6-20 characters" }}
JavaScript Basics, Login verification