In-depth understanding of the scope of JavaScript

Every person who has written a program will not be unfamiliar with the concept of scope. In this article, let's talk about the scope of Javascript. In Javascript, the global environment itself is an object. In the browser host, this object is a

A simple JavaScript Image Display and hiding example

There is a small problem today. All images are displayed on the iPhone. However, it is not possible to display all at a time. Only the image name list can be displayed. You need to click the image name to display the image. If you click again, the

The single-choice button and JavaScript for uploading files are empty for verification.

Basic JavaScript verification, which can be easily recorded here for future use. Single button and file upload are very common. In many cases, when these two controls are not used by users, they are not allowed to perform the next operation. The

DOM dynamic addition and deletion of Elements

Dynamic addition and deletion of elements are required in many places. For example, when a large amount of data is required to be collected, we need to dynamically add form forms. The following is an example:Effect demonstration Add users

Summary of the document method in JavaScript

The following methods are commonly used. Record them to make room for your brain ~ Document. title // set the document title is equivalent to the tag document in HTML. bgColor // set the background color of the page document. fgColor // set the

Differences between JavaScript in Firefox and IE

Even though it's time to use long string, dull, and different branch code to handle different browsers, occasionally, it is necessary to make some simple differentiation and target detection to ensure that a piece of code can run properly on the

Operations such as JavaScript string truncation and merging

String Truncation JavaScript provides two methods to intercept strings: slice () and substring (). Slice and substring can both accept one or two parameters. The first parameter indicates the starting position of the string to be truncated, if the

How does a JavaScript timer work?

At the basic level, it is very important to understand how the JavaScript timer works. Timer execution is often different from our intuitive imagination, because the JavaScript engine is single-threaded. Let's first understand how the three

How the JavaScript interpreter creates an object

In Javascript, the new operator can be used to create an object. How does the system use the new operator to create an object? Let's take a look at the process: First, define a class. Use the new operator to follow the function you defined to

JavaScript data type judgment

JavaScript data JavaScript data is divided into two types: simple data and complex data. Simple data includes five types: number, string, boolean, undefined, and null. There is only one type of complex data: object.Omnipotent typeof Let's first test

JavaScript DOM operations on iframe

In IE6 and IE7, we can use document.frames?id=.doc ument to access the document object in the iframe subwindow. However, this is not in line with W3C standards and is also a unique method in IE, it cannot be used in Firefox, while in Firefox, it

Tips on JavaScript

Feature Detection, not browser Detection Because XX features are not supported by a browser, we often make browser judgments directly in the Code, such: if(Broswer.isFirfox){//do something} In fact, this is not scientific, because it is very

Gossip JavaScript and Cookies

Using Cookies we already know that there is a cookie attribute in the document Object. But what is Cookie? "Some websites store some information on your hard disk with small text files, which are called cookies. "-- MSIE help. In general, Cookies

JavaScript URL Chinese character encoding conversion

When url is used for parameter transfer, some parameters or URL addresses with Chinese names are often passed, and conversion errors may occur during backend processing. In some transfer pages, GB2312 is used, and UTF8 is used on the receiving page.

How to convert and parse JSON using JavaScript

JSON strings are parsed into JSON data formats in JavaScript. There are two methods: One is to use the eval () function. Use the Function object for return parsing. Use the eval function to parse and use jquery's each method to traverse The JSON

How to quickly become a JavaScript expert

How to quickly become a JavaScript master? I have previously asked this question to my colleagues and some domestic JavaScript experts. Recently, I have been asking myself this question. The reason for this problem lies in two prerequisites: first,

High-efficiency JavaScript code writing skills

Use DocumentFragment to optimize multiple appends When multiple dom elements are added, append the elements to DocumentFragment and add DocumentFragment to the page. This method can reduce the number of times dom elements are rendered on a page. In

JavaScript obtains the events for closing or canceling a webpage.

During Web development, we often use the page Close event onbeforeunload to give users a chance to stop the event, such as this blog editor. If you choose to exit, the onunload Event will naturally be triggered. But if you choose to cancel, how can

How to Write standard JavaScript code

As a developer (WEB Front-end JavaScript development), nonstandard development not only makes code maintenance difficult in the future, but also is not conducive to team cooperation, it usually brings about code security and execution efficiency

Create a $ () file similar to JQuery for obtaining DOM objects ()

In dom operations, a single object is sometimes obtained based on the id, and multiple objects are sometimes obtained based on the className. Normally, we may use two functions to implement these two functions. However, I have integrated them. The

Total Pages: 5378 1 .... 4001 4002 4003 4004 4005 .... 5378 Go to: GO

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.