In this article
Article The author introduces seven different JavaScript syntaxes in IE and Firefox.
1. CSS "float" Value
The most basic syntax for accessing a given CSS value is:
Object. style. Property
To replace the value with a connector,
5. ClosureClosure means that the inner function can reference the variables in the function that enclose it, even if the execution of the outer function is terminated.
Let's look at a closure example first.
[Ctrl + A select all Note: If
You can use Visual Studio to debug both methods.ProgramDebugging:1. To debug the script program on the web page, the debugger requires the support of the host Program-here it is the support of IE. In fact, all the script interpreter has implemented
Currently, JavaScript implementation inheritance is not implemented through the "extend" keyword, but through the constructor function and prototype attributes. First, create an animal class.
JSCode Copy codeCode: var animal = function () {//
JavaScript and Java, C #, and other languages also have some object-oriented features. However, when comparing these features, we will find that these features are not really object-oriented, many places use the object itself to simulate
Function instanceof Object and Object instanceof Function are both true
1. We can think that an Object is a special "class", and the "class" here is: Function
So it can be understood as: Object = Function () {} or Object = new Function (); that
For example, our new window fatherpage.htm:
XML-Code:
Copy codeThe Code is as follows:
Then, you can use window. opener in childpage.htm to access elements in the parent form:XML-Code:Copy codeThe Code is as follows:
The secret can be
When style. display = "block" or style. visibility = "visible" when the Controller or see, when style. display = "none" or style. visibility = "hidden" when the controller is invisible.
The difference is that "display" not only hides the control,
The indentation of the following code snippet is not complete yet. You can download pdf to read it.
Contents
Summary
What is closure?
Execution space (Execution Context, Execution Context)
Closure usage
Closure Efficiency
Application
A good program is not written to computer, but to human. When encountering complex functions, we should consider simplifying and componentization of them and encapsulating small functions into small components. Small functional blocks can be
Let's take a look at the JSON (javascript object notation) object. JSON is a type of data exchange format object commonly used in script operations. JSON is a lightweight format compared to XML, in some intelligence ides, you can also easily operate
This effect is not very difficult in itself. It mainly takes some effort in program structure and expansion to make it easier to use and use it in more places.
Program features
1. When the same prompt box is used for multiple trigger elements, only
The cainiao version code is as follows:
You can understand this code.
Copy codeThe Code is as follows: function f_s (){
Var obj = document. getElementById ("top ");
Obj. style. display = "block ";
Obj. style. height = "1px ";
Var sw = function
Document directory
Object/Feature Detection
User-agent string Detection
Detection Operating System:
Check the code of the browser and its version
Copy codeThe Code is as follows: getBrowser: function (){
Var browser = {
Msie: false, firefox:
1. Object-oriented BasicsObjects are the basis of JavaScript. At the most basic level, an object is a set of attributes.
1. Object Creation
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
I
3. Scope
All object-oriented languages have some form of scope, and JavaScript is no exception. In JavaScript, scopes are divided by functions, rather than blocks (while, if, and so on.
Let's take a look at a simple example of scope.
[Ctrl + A
1. concat Method[Function] concatenates multiple arrays. This method does not change the existing array. It only returns a copy of the combined array.[Syntax] arrayObj. concat (array1, array2 ,...)[Instance]
[Ctrl + A select all Note: If you
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