First, form validation form
1. Create a new form:
Copy Code code as follows:
<form id= "ID is unique, not repeatable" name= "repeatable", method= "Post/get", action= "target or address, responsible for processing the server, transferring text to where" >
Method 1:post no length limit after submission, and the content is not visible after encoding.
Method 2:get commits a length limit, and the encoded content is visible in the address bar
(INPUT Element)
</form>
2, the role of the form: the Web site, the data can be transferred to the database.
3. Action properties: Action and Confirmation button
When the user clicks the Confirm button, the contents of the form are routed to another file. The action properties of the form define the file name of the destination file. This file, defined by the action attribute, usually handles the input data that is received.
Second, javascripewindow--Browser object model
1. Window objects
All Browsers support window objects, which represent browser windows. Global variables are properties of Window objects, and global functions are methods of window objects.
2, Jspopupalert message box
<input name= "" type= "Submit" onclick= "return Tijiao ()" value= "Submit"/><!--Call Method return-->
<!--JS message box-->
1 Confirm the Use of box confirm
Copy Code code as follows:
<!--1. Confirm the use of box confirm-->
<script>
function Tijiao ()
{
var zhi=confirm ("Submit");
if (zhi)
{
return true;
}
Else
{
return false;
}
}
</script>
<!--form when calling a function, add return, otherwise it will not work
2) The use of the prompt box prompt
Copy Code code as follows:
<input name= "" type= "Submit" onclick= "return Tijiao ()" value= "Submit"/><!--Call Method return-->
!--2. The use of the prompt box prompt-->
<script>
function Tijiao ()
{
var zhi=prompt ("Submit");<!--Click the Submit button to appear prompt script cue box-->
if (zhi)
{
return true;
}
Else
{
return false;
}
}
</script>
3 The Use of alert box alert
Copy Code code as follows:
<form action= "" method= "get" >
<label> Please enter your email:</label>
<input name= "" type= "text" id= "Youxiang"/>
<input name= "" type= "Submit" value= "Submit 2" onclick= "Y ()"/>
</form>
function y ()
{
var yx=new RegExp (/^[0-9| a-z|_]{1,17}@[a-z|0-9]{1,5}. (COM|CN|NET|ORG|CC) $/);
var Shuru=document.getelementbyid ("Youxiang"). Value; <!--defines a variable, calls the entire function, and must write the variable within the function-->
if (Yx.test (Shuru)) <!--test Regular expression Method-->
{
Alert ("Zhengque");
}
Else
{
Alert ("Cuowu");
}
}
</script>
3, timing timing method
settimeout (); Executing code at some time in the future--using recursive methods
Cleartimeout (); cancel settimeout ();