Web front-end development notes (2)

Source: Internet
Author: User
Tags jquery library

Web front-end development notes (1)

What are the specifications of the HTML tag writing?

    1. Page encoding.
    2. Document declaration.
    3. Keywords and descriptions.
    4. Inline elements cannot contain block-level elements.
    5. A tag cannot be nested in a tag.
    6. The label signature and attributes must be written in lowercase letters, the attributes must be quoted, the labels must be closed, and the single-label pages must be closed.
    7. Do not indent the page with  , if you want to indent it, use CSS to control it.
    8. The use of HTML tags must be semantically.
    9. To fill in the Alt and title attributes for the IMG tag.

Second, HTML static pages appear Chinese garbled how to solve?

Introduction of <meta charset= "UTF-8" >

What are the characteristics of the block attribute tag and the inline attribute tag in general?

Block Properties Tab: The default width fills the entire line without setting CSS styles, and you can set the width height.

Multiple inline attribute labels are arranged in one line without CSS styling, and cannot be set to a wide height.

Iv. how many kinds of CSS are introduced? What are the characteristics of each one?

    1. Tags introduced: The highest priority, redundant code, code size, difficult to maintain.
    2. Head Introduction: Loading speed, no server request pressure, relative to the amount of single page code is small. Code is large, difficult to communicate before and after the platform, not easy to revise and maintenance.
    3. External introduction: A CSS file can control multiple pages, the code is simple, easy to work together. Using the caching mechanism effectively, the HREF attribute in the external introduction will put the request pressure on the server.

V. How do you understand absolute positioning and relative positioning? Where do you use them?

When overlays appear on the page, absolute positioning can be used, or when multi-graph floats are resolved, absolute positioning is also available.

Relative positioning provides the origin of the positioning for absolute positioning, with no effect for individual use.

Vi. the relationship between JS and Java

Java is a rigorous object-oriented programming language that is often used to develop Internet-based applications. JavaScript is a scripting language that enhances interactivity and page effects in a common language Web page, as well as data validation. Java is a product of sun, and JavaScript is a Netscape company that has no connection.

Seven, what norms specify the syntax of JS

ECMAscript

Introduction Method of JS

    1. Use <script></script> tags to embed the page directly, usually placed in the head tag, can also be placed inside the body tag, as long as the code is called before the call has been read and loaded into memory.
    2. The advantage of using external JS files is to realize the separation of performance behavior, the Web page, style, behavior are separated, so that the page structure is clear, convenient maintenance and team development. In the external JS file directly write the JS code, the introduction of the way is: <script type= "Text/javascript" src= "A.js" ></script>
    3. Event code directly as a tag: <input type= "button" value= "OK" onclick= "documet.write (' hello ')"/>

Nine, JS naming specification

  1. The case is different.
  2. The first character must be a letter, underscore, or dollar sign.
  3. Characters other than the first character can be made up of numbers, letters, underscores, dollar signs, and so on.
  4. Spaces are not allowed.
  5. cannot be named with a keyword or a reserved word.
  6. The variable name must be a lowercase letter.
  7. The name of the class uses the Camel naming convention.
  8. Shorthand words cannot use uppercase names as variable names.
  9. The name of the method must be a verb or a verb phrase.
  10. The name of the public class must be named with a mixed name.
  11. A CSS variable must be named with the same public class variable that it corresponds to.
  12. A variable property member of a private class must be named with a mixed name and underlined in front.
  13. If the variable is set to private, you must precede the underscore.
  14. A generic variable must be named with a type that is consistent with its name.
  15. All variable names must use the English name.
  16. If a variable has a broader scope, a global variable must be used, at which point a member of a class can be designed. The relative ones, such as smaller scopes or private variables, are named with concise words.
  17. If the variable has its implied return value, avoid using its similar method.
  18. Public variables must clearly express their own attributes to avoid ambiguity.
  19. The class constructor can be named with the name of the extension's base class, so that the name of its base class can be found correctly and quickly.

Ten, JS writing code

  1. File encoding unified for UTF-8.
  2. During the writing process, each line of code must end with a semicolon.
  3. Library is introduced, in principle only the jquery library is introduced.
  4. Code structure is clear, add appropriate comments, improve the function reuse rate.
  5. Focus on separation from HTML, reduce reflow, and focus on performance.
  6. Put the external JS file in front of the HTML bottom,</body>.
  7. Optimize loops. If there is DOM operation in the loop body, the DOM operation should refer to the loop body, and within the same scope, the DOM chooses to assign to a local variable.
  8. Avoid confusion, it is recommended to use double quotes in HTML and single quotes in JS.
  9. Write innerscript in a simpler format.
  10. Avoid mixing with other technologies, JS does not directly control the CSS style settings, control classname.
  11. Avoid global variables.
  12. Declaring a variable always uses var.
  13. Use square brackets to get object properties.
  14. Avoid using the eval () method.
  15. Do not omit "and {}."

What are the data types of the Xi. JS?

Number numeric type

string literal type

Boolean Boolean type

function functions

Object objects

Null empty value

Undefined no type defined

12. The difference between i++ and ++i

++i is the first increment of 1 and then participate in the operation, i++ is involved in the operation after adding 1.

13, the variable in JS = = and the difference between = = = Judgment?

= = is a value equal

= = = is exactly equal, including type

14. The difference between break and continue

The break and continue statements are used to precisely control the execution of code in a loop.

The break statement immediately exits the loop, forcing the statement after the loop to continue executing.

The continue statement exits the loop immediately, but exits the loop and resumes execution from the top of the loop.

What's the global variable, and what's the local variable.

Interpret the function as a box.

A variable declared inside a function is a local variable that cannot be accessed outside the function.

Variables declared outside the function are global variables that can be accessed inside the function.

16, explain the scope.

All variables exist in an execution environment (also called a scope), which determines the life cycle of the variable and the variables that the part of the code can access. Summarize:

    1. The execution environment has a global execution environment and a function execution environment.
    2. Each time you enter a new execution environment, you will create a scope to search for variables and functions.
    3. The local environment of a function not only has access to variables in the scope of the function, but also has access to its parent environment, and even to the global environment.
    4. The global environment can only access variables and functions that are defined in the global environment, and cannot directly access any data in the local environment.
    5. The execution environment of a variable is useful to determine when memory should be freed.

17, what is called page refactoring.

Page refactoring can be understood as "convert design to Web page", it can be simple to the pad image directly into the page, it can be complicated to consider the use of each label in the page, consider page performance. The job content is generally "design draft-transduction-write HTML and CSS". Page refactoring and front-end relationships can be understood as: page refactoring is the refinement of the front-end work.

18. The difference between the hidden label (Display:none; and Visibility:hidden;)

Display:none; Set the element to none that is, no, the browser will not make a rendering action when parsing none, that is, not to account for the memory value.

Visibility:hidden; Set the element to be hidden, although it is not visible on the page, but it occupies a position, the browser will still render the action, that will occupy memory value.

Welcome Message ~

Web front-end development notes (2)

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.