Function expression called nowImmediately-invoked function expression. ProtectionCodeIt is free from interference from other code and organizes your code through encapsulation.
Events & MessagesEvents & messaging. In Web applications, you can use
A strange problem occurred recently in the project. Some scripts are only embedded. the ASPX page can be correctly executed if it is stored separately. in the JS file, and then in. when aspx is connected to a script file, it cannot be run, and the
Produce Boolean value from other typesAll objects in javascript can be converted to boolean implicitly, look at these examples:
0 = false; // true1 = true; // true ''= false // truenull = false // true
But these values are not the type of
The
Observer Pattern(A subset of the asynchronous
Publish/Subscribe
Pattern) is a software
Design Pattern in which an object,
Called the subject, maintains a list of its dependents, called Observers, and
Notifies them automatically
Always specify the second argument-parseintParseintConverts a string to an int number, the syntax is:
Parseint (STR, [Radix])
The second argument is optional, which specify the radix of the first argument.If you omit Radix, following the rules:->
Javascript doesn' t have block ScopeBlock doesn' t have scope in Javascript, only function has scope.
For (VAR I = 0; I
If you want to create scope, use anonymous function:
(Function () {for (VAR I = 0; I
Nan is weirdNan indentifies a
Fast String concatenationWe always use+To concatenate small strings into a large one, which is considered to be a good practice.But there will be a major hit on performance if you do need String concatenation operations on IE browser.Consider these
IsUndefinedA reserved wordIt seems like so, but actually it doesn' t.
VaR undefined = 'hello'; undefined; // 'hello'
This may surprise you, but it does work well.UndefinedIs just a pre-defined variable.
Note: never assign a valueUndefined,
Www.jsyks.com cheating
I reported a small driving school, And I used this website to simulate the test.
I had to use this trick.
1. Forcibly modify the test results
Javascript: document. getelementbyid ('df _ fs '). innerhtml = ' 100 ';
To declare a string in Javascript, we can easily use the literal (literal) Syntax:VaR str1 = 'Hello JavaScript! ';
VaR str2 = "Hello world! ";
Since everything in Javascript is an object, we can also create it using the new syntax:
Code
I have been using JavaScript for many years and have written countless functions, but today I have really understood the differences between the two function definitions. It is really a tragedy. I wrote this article to remind myself to lay a solid
We should be familiar with JavaScript inheritance and things that we talk about in the old age. We usually do not use them directly in normal work. We are not busy during this time, so I have learned some basic knowledge and practiced it by myself,
Document directory
Validate ()
Writeerror ()
Removeerror ()
This chapter details the method of Form Error prompts, which is much better than the method that uses mostly warning boxes.
In my opinion, the warning box is only used when the
Document directory
Since a range is created
Read the start and end positions of the constituency.
This chapter introduces the range object. With this object, you can select any part of the HTML document and perform some operations based on the
Document directory
Instance 1
Instance 2
Background: array. Sort ()
Sourceindex
Comparedocumentposition
HTML has some related elements with different tag names, such as H1-H6 or input, select and textarea. Getelementbytagname can only
Document directory
Texts, textarea, and hidden fields
Select boxes
Checkboxes
Single region
In this chapter, I will introduce some codes used to detect user input. With these codes, you can also write your own detection functions.
Because
Recently, a student asked me about the convenience of JS. The following article is taken from the Internet.
Use JavaScript to modify webpage stylesI,Partial style changeYou can change the direct style, classname, and csstext. Note that:Case
Document Object content set
Document Object-Javascript script language description-----------------------Note: The element name attribute on the page and the name referenced by JavaScript must be case-sensitive.Otherwise, an error message "the
Document directory
1. Modify the pop-up menu method scripthelper. showdivcommon to implement website business logic
2. Use "document. onclick =" or "" to add an event Function
Scripthelper
Commonscript
Jsfooter. js
Complete instance Page
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