Function
Code
Copy code The Code is as follows: function parseurl (URL ){
VaR A = Document. createelement ('A ');
A. href = URL;
Return {
Source: URL,
Protocol: A. Protocol. Replace (':',''),
HOST: A. hostname,
Port: A. Port,
Query: A.
Basic Structure of Singleton mode:
CopyCode The Code is as follows: mynamespace. Singleton = function (){
Return {};
}();
For example:Copy codeThe Code is as follows: mynamespace. Singleton = (function (){Return {// public members.Publicattribute1:
In JSON format, objects, arrays, values, strings, and numbers can be used ).
CopyCode The Code is as follows:
Reference: http://www.json.org/json-zh.html
Let's take a look at the Javascript eval function.The eval function evaluates a given
Javascript overload functions are generally operated by arguments.
For example:
CopyCode The Code is as follows: var afunc = function (){
ARGs = arguments;
If (ARGs. Length = 1 ){
Console. Log (1 );
} Else if (ARGs. Length = 2 ){
Console. Log (2 );
Original ENGLISH Createadder (X) is a function that returns a function. in JavaScript, functions are first-class objects: they can be passed to other functions as arguments and returned from functions as well. in this case, the function returned is
Although jquery's use is gradually reduced (it is still used in projects, and the efficiency is high. I usually don't need it). I hope to reduce the dependence on jquery.
However, this chain operation method is really attractive (it seems that many
Window. event object difference IE: window. event object
FF: There is no window. event object. You can pass the event object to the function parameters. For example, onmousemove = domousemove (Event)
Obtains the current mouse coordinate. IE:
In this article
Article The author introduces the differences between 7 JavaScript codes in IE and Firefox.
1. CSS "float" Value
The most basic syntax for accessing a given CSS value is: object. style. property, replace the value with a
Core
Code :
Copy code The Code is as follows:
Control Code:Copy codeThe Code is as follows:
Demo: below is my HTML code. At first glance, I can see what is going on: the third empire has probably issued regulations on unofficial ghost places.
In the prototype and inheritance document of JS, which must be known for front-end development, we have mentioned writing closures below. In addition, we have recently discovered that we need to enhance the application capabilities of closures, so
Problem:
This allows you to use the previous settings when accessing the page or share data between different pages. For example, if you set the page font size when visiting a website, you will want to use the same settings for browsing next time
Isn't the setTimeout method of the window object used? Bingo, that's right! If you often need to "execute a certain Function with latency" in an application, you can extend the global object of the Function Based on the DRY principle and add a delay
The code is still simple. So there is still no explanation ..
Copy codeThe Code is as follows:/** KOverLoad
An auxiliary method for creating overloaded functions.
Supplement the previous function.
@ Author ake 2010-07-03
@ Weblog
Windows objectsThe top-level object of each HTML document.AttributeFrames [] sublists array. Each sublists array is stored in the order defined in the source document.Feames. length: Number of child partitions.Self current window.Parent window (the
Introduction to functional programming When it comes to functional programming, people often make the first impression of their academic school, which is obscure. It is probably the only programming method that is used by university professors who
In practice, we can define interfaces in annotations and implement them in actual code.
For example:
Copy codeThe Code is as follows :/*
Interface Composite {
Function add (child );
Function remove (child );
Function getChild (index );
}
Interface
Function A (x)
{
This. x = x;
}
Alert (A. prototype );
Alert (A. prototype. constructor );
Based on the pop-up results, we can get that the prototype Object is created by the function constructor, and its attributes can be shared by all objects. In
1. The number is long. The valid long integer number in c # Is In javascript ......
Let's look at the following simple code:
Copy codeCode: var a = 2010060612120909191; // Id1 generated by Time
Var B = 2010060612120909199; // Id2 generated by
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