12-01JS form validation and Jswindow

Source: Internet
Author: User

Forms Verification Form

1. Create a new form:

<form id= "ID is unique, cannot be duplicated" name= "repeatable", method= "Post/get", action= "destination or address, responsible for processing the service side, transfer text to where" >

The 1:post method does not have a length limit after submission and the content is not visible after encoding.

Method 2:get Commit has a length limit, and the encoded content is visible in the address bar

(INPUT Element)

</form>

2, the role of the form: to be able to transfer URLs, data piece to the database.

3. Action properties: Action and Confirm button

When the user clicks the Confirm button, the contents of the form are transferred to another file. The action properties of the form define the file name of the destination file. This file, which is defined by the action attribute, is usually processed in connection with the input data received.

Second, javascripewindow--Browser object model

1. Window object

All Browsers support window objects, which represent browser windows. A global variable is a property of a Window object, and a global function is a method of a Window object.

2. Jspopupalert message box

<input name= "" type= "Submit" onclick= "return Tijiao ()" value= "commit"/><!--call method plus return-->

<!--JS message box--

1) Confirm the use of box confirm
<!--1. Confirm box confirm usage--
<script>
function Tijiao ()
{
var zhi=confirm ("commit");
if (zhi)
{
return true;
}
Else
{
return false;
}
}
</script>
<!--form adds return when calling a function, otherwise it doesn't work

2) Use of the prompt of the cue box

<input name= "" type= "Submit" onclick= "return Tijiao ()" value= "commit"/><!--call method plus return-->

!--2. Hint box prompt usage--
<script>
function Tijiao ()
{
var zhi=prompt ("Commit");<!--in the Click submit button, the Prompt Script prompt box appears--
if (zhi)
{
return true;
}
Else
{
return false;
}
}
</script>

3) The Use of alert box alert

<form action= "" method= "get" >
<label> Please enter your e-mail:</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; <!--define a variable, call the whole function, you must write the variable in function--
if (Yx.test (Shuru)) <!--test Regular expression method---
{
Alert ("Zhengque");
}
Else
{
Alert ("Cuowu");
}
}

</script>

3, the method of timing timing

SetTimeout (); Execution code in the future--using recursive methods

Cleartimeout (); cancel settimeout ();

Third, the jquery library (emphasis)--is a JavaScript library.

The main jquery function is the $ () function (jquery function). If you pass a DOM object to the function, it returns a JQuery object with the jquery functionality added to it.

JQuery allows you to select elements through the CSS selector.

1) Syntax:

$ (this). Hide ()-hides the current element

$ ("P"). Hide ()-Hides all paragraphs

$ (". Test"). Hide ()-hides all elements of class= "test"

$ ("#test"). Hide ()-hides all elements of the id= "test"

2) Selector

<1> Property Selector: JQuery uses an XPath expression to select an element with a given property.

$ ("[href]") selects all elements with an href attribute.

$ ("[href= ' # ']") selects all elements with an HREF value equal to "#".

$ ("[href!= ' # ']") selects all elements with an HREF value that is not equal to "#".

$ ("[href$= '. jpg ']") selects all elements with an href value ending with ". jpg".

<2> element selector: JQuery uses CSS selectors to select HTML elements.

$ ("P") select the <p> element.

$ ("P.intro") selects all the <p> elements of the class= "Intro".

$ ("P#demo") selects all <p> elements of the id= "demo".

<3>css selector: The jQuery CSS selector can be used to change the CSS properties of HTML elements.

3) Event

4) Effect

<1> Fade in

<2> Hide Display

<3> Sliding

12-01JS form validation and Jswindow

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.