One of the most powerful JavaScript keywords is this. Unfortunately it is hard to use if you don't exactly know how it works.
In JavaScript, this is one of the most important keywords. This post tells you how to make good use of this.
Below I
Many websites are composed of form submissions, but verification is required for some submissions. The simplest method for client verification is to use JS custom functions. This document contains 28 common verification functions and several
Map in Java is a very practical set and is used to using Map in Java. It is uncomfortable to use other languages without Map, I used to use Map when I wrote Flex AS Code. However, AS actually has a Dictionary class that can replace Map in Java, you
Closure is a difficult and characteristic of Javascript language. Many advanced applications rely on closures for implementation.1. Scope of Variables
To understand closures, you must first understand the special variable scopes of Javascript.
To create a page, you need such a function: When the mouse goes through the thumbnail, the thumbnail's big image is displayed at the same time. After searching on the Internet, there are too many garbage stations, so I wrote one myself. It is
The wizard allows your website users to quickly get started with your web applications and improve the attractiveness of your website. The wizard is generally divided into several steps, each step collects some data, and supports the return function,
How to obtain the maximum and minimum values for an array. The common method is estimated as follows:
If you are introducing a class library for work and are afraid that the class library has also implemented a prototype method of the same name, we
DOM provides a method named getElementById (). This method returns an object, which is the element node corresponding to the parameter id. In addition, the getElementByTagName () method returns an array of objects, each of which corresponds to an
Event stream
JavaScript events exist in the form of a stream. An event will have multiple elements responding at the same time. Sometimes this is not what we want. We only need a specific element to respond to our binding event.Event
Sometimes we need to remind users that there are new messages, which can be implemented using the following method.
The effect is that when the webpage window does not obtain the focus and is minimized, the title bar "title" of the webpage window
Basically, all JS data types have the valueOf and toString methods, except null. They solve the javascript value calculation and display problems.ValueOf () method of JavaScript
The valueOf () method returns the original value of a Boolean object.
Javasrt RT events have two important features: Event bubbling and target elements.
When an event on an element is triggered, for example, if you click a button, the same event will be triggered in all the ancestor elements of that element. This
Effect demonstration
This effect is produced by using the third parameter setTimeout. SetTimeout/setInterval. These two functions are familiar to front-end developers. They can also be used in non-IE (6-9) browsers as
First look at the Code:
1111 2222 3333
In the most typical example, no matter which result is clicked, the above Code is the final value, because the function received by the click event forms a closure, the I in the closure is only a
It is very easy to convert json data sent by background programs (such as php) into javascript arrays or objects. The Code is as follows:
// Assume that the json data sent in the background is '{a: 2, B: 1}' stored in str var data = eval ('+ str + ')
The following experiment demonstrates the efficiency of the push () and CreateElement () functions in creating HTML elements. It can be seen that the practical push () is indeed more efficient than the latter, but it can be much higher, but you
Json is widely used in Web development. As a carrier of data transmission, It is very common to parse Json returned data. The following describes four ways to parse Json:Part 1
var list1 = [1,3,4];alert(list1[1]);var list2 = [{"name":"leamiko","xing"
I read a lot of code on the Internet that uses JavaScript code to insert text at the cursor. Many of them are useless, just copying each other, which is a waste of time. A new method has been used recently to meet this requirement. IE supports the
The braces "{}" in Javascript have four meanings:
Semantics 1. Organize compound statements, which are the most common:
if( condition ) { //...}else { //...}for() { //...}
Syntax 2: Object Direct Volume declaration:
var obj = {name :
It is very common to use the webpage title to prompt users to have new messages, such as Weibo and some mailboxes, which are common. How to implement a single function?
The idea is: access the background through ajax. If there is a new message,
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