HTML <form> tag:
The form element can be used to create a form for user input. A form can contain text fields, check boxes, and single-choice buttons. A form is used to transmit user data to a specified URL.
Required attribute: defines the address of Form submission in the Action attribute.
Attribute |
Value |
Description |
|
Action |
URL |
The URL of the data to be transmitted when the confirmation button is pressed. |
|
Optional attributes:
Name |
Form_name |
Define the unique name of a form |
Method |
|
The HTTP method used to send data to the action URL. The default value is get. Method = "get ":This method can transmit the Form Content in the URL: URL? Name = Value & name = value. Note: If the form value contains non-ASCII characters or exceeds 100 characters, you must use method = "Post ". Method = "Post ":This method can be used to transmit the Form Content in the Request body. Note: This method transfers the Form Content in the Request body. |
Doctype HTML public declaration:
Doctype is commonly declared as HTML 4.01 XHTML 1.0 XHTML 1.1. The specifications include strict, transitional, and frameset.
The use of doctype can speed up browsing, check whether your site meets Web standards: http://validator.w3.org/
The DTD (such as the xhtml1-transitional.dtd) is called the document type definition, which contains the document rules, the browser according to your definition of DTD to explain your page identity, and display.
To create a standard web page, the doctype Declaration is an essential part. Your logo and CSS will not take effect unless your XHTML determines a correct doctype.
! The doctype element does not need to disable tags.
HTML xmlns attributes:
This attribute represents the namespace of the document
xmlns
Is the abbreviation of XML namespace
Because XML allows you to define your own identifiers, the identifiers you define may be the same as those defined by others, but they indicate different meanings. Errors may occur when files are exchanged or shared. To avoid such errors, XML uses namespace declarations, allowing you to identify your identity through a URL.
XHTML is the identifier language for the transition from HTML to XML. It must comply with XML document rules, so you also need to define the namespace. Because xhtml1.0 cannot be a custom identifier, its namespace is the same as http://www.w3.org/5o/xhtml.
Example:
Simplerequest.html:
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 strict // en"
Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> simple XMLHttpRequest </title>
<SCRIPT type = "text/JavaScript">
VaR XMLHTTP;
Function createxmlhttprequest (){
If (window. activexobject ){
XMLHTTP = new activexobject ("Microsoft. XMLHTTP ");
}
Else if (window. XMLHttpRequest ){
XMLHTTP = new XMLHttpRequest ();
}
}
Function startrequest (){
Createxmlhttprequest ();
XMLHTTP. onreadystatechange = handlestatechange;
XMLHTTP. Open ("get", "simpleresponse. xml", true );
XMLHTTP. Send (null );
}
Function handlestatechange (){
If (XMLHTTP. readystate = 4 ){
If (XMLHTTP. Status = 200 ){
Alert ("the server replied with:" + XMLHTTP. responsetext );
}
}
}
</SCRIPT>
</Head>
<Body>
<Form action = "#">
<Input type = "button" value = "start basic asynchronous request" onclick = "startrequest ();"/>
</Form>
</Body>
</Html>
Simpleresponse. xml:
Hello from the server!