1. Form verification form
1. Create a new form:
The code copy is as follows:
<form id="id is unique and cannot be repeated" name="repeatable", method="post/get", action="target or address, server responsible for processing, where to transfer text, etc.">
//Method 1: There is no length limit after post submission, and the content after encoding is not visible.
//Method 2: There is a length limit for get submission, and the encoded content can be seen in the address bar
(input element)
</form>
2. The function of the form: it can transfer URLs and data to the database together.
3. Action properties: action and confirm buttons
When the user clicks the confirm button, the contents of the form are transferred to another file. The action attribute of the form defines the file name of the destination file. This file defined by the action attribute usually performs related processing on the received input data.
2. JavaScript Window-Browser Object Model
1. Windows object
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"/><!--Add return-->
<!--Js message box-->
1) Confirm the use of confirm box
The code copy is as follows:
<!--1.Usage of confirm box confirm-->
<script>
function tijiao()
{
var zhi=confirm("Submit or not");
if (zhi)
{
return true;
}
else
{
return false;
}
}
</script>
<!--A form adds return when calling the function, otherwise it will not work
2) Use of prompt box prompt
The code copy is as follows:
<input name="" type="submit" onclick="return tijiao()" value="submit"/><!--Add return-->
!--2. Usage of prompt box prompt-->
<script>
function tijiao()
{
var zhi=prompt("Submit whether to submit");<!-- When clicking the submit button, the prompt box for the propt script -->
if (zhi)
{
return true;
}
else
{
return false;
}
}
</script>
3) Use of alert box alert
The code copy is as follows:
<form action="" method="get">
<label>Please enter your email address:</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|Az|_]{1,17}@[Az|0-9]{1,5}.(com|cn|net|org|cc)$/);
var shuru=document.getElementById("youxiang").value; <!--Define the variable, and the entire function is called, the variable must be written in the function-->
if(yx.test(shuru))<!-- Method of test regular expression-->
{
alert("zhengque");
}
else
{
alert("cuowu");
}
}
</script>
3. The timing method
setTimeout(); Execute code at some time in the future--using method using recursion
clearTimeout();Cancel setTimeout();