This method is used to replace the Equal Value Comparison in the switch.
Generally, each comparison of the same value needs to be judged repeatedly.
The use of user-defined functions avoids repeated judgment and improves the efficiency.
The
Recently, an internal project needs to be used.Organization chart(Organization chart), looking for some open-source projects and their class libraries, found that there is no ready-made JS class libraries available for use, find some simple JS
Js operation Cookie Code. The Code below contains detailed comments, so I will not talk about it here. go directly to the Code:
/** Set and retrieve cookies*/Var Cookie = {}// Write the Cookie. The key is the key and the value is the value.//
An error message was reported recently when ExtJS was used to build the webpage interface. The prompt in IE is as follows:
Exception thrown and not caught, row 19 ....
The Firefox prompt is as follows:
Uncaught exception: No center region defined
Examples of JavaScript for/in loop usage, although For and IN are not used to, but each has its own advantages and personality. It is a good code when used.
for/in loop test the for/in loop
JS batch get class naming node getElementsByClassName ()GetElementsByClassName () is an old method, which is optimized and provided to you.The Code is as follows:// Obtain class naming nodes in batchesFunction getElementsByClassName (className, tag,
JavaScript uses indexOf to search for a string and return the position. Because the effect is relatively simple, the running function is no longer used for demonstration. You can test the function by copying the code to any HTML file.
Copy to
Today I encountered a bug in the Internet Explorer onchange event. This bug exists in all Internet Explorer versions (6, 7, 8). I don't know if it's a bug, or did I design it like this on purpose? Let's take a look at the reproduction process of the
I spent two nights writing a google map application, using Map api, weather api, and localsearch api. I want to write some articles about Google map API, today, I will write a method for automatically scaling a map to an appropriate level. Here,
1) the parameters in the sending path are in Chinese, and the received parameter values in the server segment are garbled.For example:Var url = "a. jsp? Name = Xiao Li ";XmlHTTP. open ("post", url, true );Solution:Use the escape () or encodeURI ()
IntroductionThis article mainly discusses the ECMAScript execution context and related ECMAScript executable code.
DefinitionEach time the controller is transferred to ECMAScript executable code, it enters an execution context.
Execution context
In javascript, you can use = to compare whether the two data types are equal. If the two data types are different, the data will be compared after conversion. The conversion rules are as follows:
L if the type of one of the operands is Boolean,
On the page, define the onresize event for the window object. When the window is scaled out, the onresize method is executed multiple times, affecting the page performance.I checked some information on the Internet, saying that in ie and opera, the
In the past, I used javascript to write a verification text box that can only input decimal places (two decimal places need to be retained). Remember that it is mainly implemented by judging eventkey or evencode, the text box must be added for the
Many browsers implement a public subset of JavaScript, making most of the Code compatible with different browsers. The incompatibility problem is not the language itself, instead, the underlying Document Object Model (DOM) opened by the browser is
EgExp object (the most easy-to-understand and in-depth Regular Expression tutorial I have seen so far) JavaScript provides a RegExp object to complete operations and functions related to regular expressions, each regular expression pattern
Copy to ClipboardReference: [www.bkjia.com] connection string
SEARCH stringsLocate the position of a stringStr. indexOf (subStr)Str indicates the specified string. subStr indicates the substring to be searched.Search for characters at a specified
By adding an attribute or type selector to the element, you can use CSS settings to implement a two-color table. However, if the table is very long, it is really troublesome to add elements one by one. In addition, such code is not easy to maintain.
I have not studied Javascript deeply. Although I have many C # class libraries of my own, I don't have a js class library of my own. I have been using it all the time and try again. In the future, we will encapsulate common js methods like C #
Recently I read Dean's "Convert any color value to hex in MSIE" and finally solved the problem of obtaining color rgb values based on keywords.
JavaScript color gradient and gradient effect color gradient change Demonstration:
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