JavaScript and Ajax sections (2)

Source: Internet
Author: User
Tags html tags tag name

11. How the DOM operates the document's standard node?

1) View nodes: Using getElementById (), Getelementbyname (), getelementbytagname can view any element in an HTML document.

2) Create and Add nodes: Create nodes using createelement ("tag name"), for example: createelement ("img").

3) There are three ways of adding nodes:

AppendChild (nodeName) adds a new child node to the end of an already existing node list.

InsertBefore (Newnode,oldnode) Inserts a new child node before the specified node.

CloneNode (deep) copies a specified node, deep is a Boolean value, and when Deep is true, the specified node and all child nodes are copied, and when Deep is false, only the specified node and its properties are copied.

4) Delete and Replace nodes: Use removechild (none), ReplaceChild (Newnode,oldnode) respectively.

12. CSS What kinds of style sheets are there? ?

Inline style sheet : Inline style sheets are blended in Used in HTML tags.

Internal style sheet : The internal style sheet is placed inside the

external style sheet: An external style sheet is a separate file that defines a variety of style rules for easy access to multiple HTML file to use. There are two ways to import an external style sheet:

1) use <link rel= "stylesheet" href= "Style.css" type= "text/css" > tags in the page to link to the external style file.

2) Import the external style file using the @import method in the page .

13. in JavaScript String Object Common Methods ?

Properties length Usage: String Object . Length.

common methods for string objects:

toLowerCase (): Converts the string to lowercase.

toUpperCase (): Converts the string to uppercase.

CharAt (Index): Returns the character in the specified position.

IndexOf (String, Index): finds the position of the first occurrence of a specified string in a string.

SUBSTRING (INDEX1,INDEX2): Returns the string between Index1 and Index2 at the specified index, and includes the location of the index index1, excluding the location of the INDEX2.

14. common methods and events for text box objects

event:onblur: Loses focus and fires when the cursor leaves a text box.

Onfocus: Gets the focus, which is triggered when the cursor enters a text box.

onkeypress: One of the keyboard keys is pressed and released.

method:Blur: Move the focus away from the text box.

Focus: Sets the focus in the text box to get the mouse cursor.

Select: Select the content in the text field.

property:ID: Sets or returns the ID of the text field.

Value: Sets the value of the values property that returns the text field.

Name: Names of controls

make text input cue effects and use the innerHTML property to dynamically change the contents of the prompts in the layer.

15. the concept of regular expressions

A regular expression is a logical formula for a string operation , which is a "rule string" that is used to express a filter logic for a string, using predefined specific characters and combinations of these specific characters.

Regular expression effect:

1. Test whether the given string conforms to the filtering logic of the regular expression (called "match");

2. You can get the specific part we want from the string using a regular expression.

Regular expressions are characterized by:

1. Flexibility, logic and functionality are very strong;

2. Complex control of strings can be achieved quickly and in a very simple way.

3. For people who have just come into contact, it is more obscure and difficult to understand.

because regular expressions are primarily applied to text, they are applied in a variety of text editors, as well as the famous editor EditPlus, large editors, such as Microsoft Word, Visual Studio, can use regular expressions to work with text content.

16. There are several ways to construct regular expressions , what are the differences?

one is the normal way var reg =/Expression/;

One is the construction of var reg = new RegExp (' expression ', ' parameter ');

17. RegExp What methods does an object use to match a regular expression?

Test () : Retrieves the value specified in the string, returning true or False

exec (): The search character matches the regular expression, returns the found value, and determines the location.

18. Write the URL format of HTTP with regular expressions

/^http://([\w-]+\.) +[\w-]+ (/[\w-./?%&=]*)? $/

Http://baike.baidu.com/view/94238.htm?fr=aladdin

19. How do you understand Ajax and what is Ajax?

the full name of Ajax is asynchronous JavaScriptand XML, where asynchronous is asynchronous and it differs from traditional Web The way in which synchronization is used in development.

Ajax is not a new technology, but a combination of several original technologies. It is a combination of the following technologies.

1) use CSS and XHTML to represent.

2) use the DOM model for interactive and dynamic display.

3) use XMLHttpRequest to communicate with the server asynchronously.

4) use JavaScript to bind and invoke.

20. What steps are required to implement an AJAX asynchronous call

1) Create an XMLHttpRequest object , that is, create an Asynchronous Call Object .

2) Create a new http request and specify the method,URL , and authentication information for the http request .

3) set a function that responds to changes in the state of the HTTP request .

4) send an HTTP request .

5) Gets the data returned by the asynchronous call .

6) use JavaScript and DOM for local refreshes .

JavaScript and Ajax sections (2)

Related Article

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.