In millions of Internet pages, JavaScript is used to improve design, verify forms, detect browsers, and create cookies. Javascript is the most popular scripting language on the Internet and can be run in all major browsers, for example, Internet
Daniel Clifford gave a wonderful speech at Google I/O 2012, "Breaking the Javascript speed limit with V8 ". In his speech, he explained 13 simpleCodeThe optimization method allows your code to compile/run your JavaScript code more quickly in
Console. Log ();
When you use the console. Log () function, the following firebug must be enabled. Otherwise, this function is invalid when running in Firefox and affects the normal operation.ProgramIf you open it with IE, an error will occur.
FunctionFors () {obj_a=Obj_ B; obj_ B .attr=Obj_a ;}
FunctionFors () {obj_ B={}; Obj_ B .attr=Obj_ B ;}
The above are two explicit circular references. Memory leakage occurs in IE. Due to the memory recycle mechanism of IE, it will occupy
To judge whether it is to select two or more options. For example, if I go to a branch road in front of my house, as long as I know which road is right for the first time, I don't have to think about it any more next time or in the future, take that
For(VAR I = 0; I ) {Items [I]. onclicn=FN ;}
For(I = items. length; I --;) {Items [I]. onclicn=FN ;}
For(VaRI = 0, Len = items. length; I ) {Items [I]. onclicn=FN ;}
1. One query of attributes of the control condition, such as items.
Last week, a knowledge point I learned from guoxing's http://weibo.com/runflash didn't wait until his blog, so I took the lead to record it. (Xiao must have laughed)
Problem:CodeWhat is the role of "javascript:" In?
InputType= ButtonValue=
Function Quicksort (ARR ){ // If the array has only one number, it will be returned directly; If (ARR. Length ){ Return Arr ;} // Locate the index value of the number in the middle; if it is a floating point, it is rounded down.
A common method is to input a function to the native sort method of the array. This function returns 1 or-1 randomly to arrange the array elements randomly.
Arr. Sort (Function(A, B ){ReturnMath. Random ()>. 5? -1: 1 ;});
This method is
Function lastname (){
// Obtain the path of the file to be uploadedVaR filepath = Document. getelementbyid ("file1"). value;
// To avoid escape backslash problems, convert it hereVaR Re =/(\ +)/g;
VaR filename = filepath. Replace (Re ,"#");
//
(Bad. The previous analysis was incorrect. I have not asked this question !!!)
I saw it yesterday."Wonderful classroom"Of an Apple menuDemo. According to the "stock theorem" mentioned in ". I analyzed it myself.Code. As follows:
Come first!
Let's talk about one of the most common ideas:
Pack the pictures with UL and set float. Then set the UL as absolute positioning, and its parent tag is located using relative. You can set the left or top values of UL to scroll the image queue.
Set the followingCodeAdd to the beginning of JavaScript/* @ Cc_on _ d = Document; EVAL ('var document = _ D ')@*/
The document with such a line of code Ie can be accessed at least five times fasterThe following is the test comparison code before
Loop
Loop is a commonly used control structure. Most things are completed by it. In JavaScript, we can use for (;), while (), for (in) in fact, the efficiency of for (in) in these three loops is very poor, because it needs to query hash keys, as
Add a column checkbox in the gridview (the templatefied column added in the gridview, And put checkbox ). When you click the button to submit, You need to verify whether a checkbox is selected, its JS Code is as follows:
If (k = 0){Alert ("
In actual use, it is found that JS is of great use, and its own JS water is a dish, regret it was just a few minutes ago. Only learning and accumulating from now on (continuously updating ...)
1. Control focus: Document. getelementbyid ("tbname
Javascript is an object-oriented language based on Prototype, which is different from the familiar. NET and Java language based on Class mode ).
Therefore, javascript does not have the concept of classes. It is very important to understand this.
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