1, the problem background:
encountered a small display of customer department name (Pinyin) business in the project, is under the department name has the corresponding pinyin, and in the existing database does not have the corresponding field,
Such. There's a problem here, for example, in a line in the code, I would like to use a declared variable x, the result of typing or spelling errors, the variable is written y, the result is equivalent to "implicit" declared a variable y, in the
IE there is still a sharp weapon has not been used, that is VML. Although not as SVG, it is still very powerful. On the implementation gradient, its fill is much more powerful than IE's gragient filter. But VML appeared earlier, supporting only a
Here does not carry on the very complex background verification as well as the JavaScript regular expression, simply introduces this technique, the simple backstage receives with jumps, probably understands how verifies can. Specific technology, I
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Note: In IE, you need to change the "Maximum number of script steps" for IE in this test:
[HKEY_CURRENT_USER\Software\Microsoft\Internet
0-Determine whether the variable, parameter initialization
if (x) {}//variable is initialized or the variable is not empty or the variable is not zero
1-The Declaration function does not need to declare the return value, the parameter
JavaScript is not an object-oriented language and does not provide a traditional way of inheriting, but it provides a way of prototyping inheritance, using the prototype properties provided by itself to implement inheritance.
The prototype chain is
So, more and more portals are also starting to add ratings or voting functions, here are 9 excellent JavaScript implementations of the rating voting Plug-ins and teaching materials to facilitate your two times development and use.
JQuery Start
The diagram below is my idea of design
The following is the specific JS code
1, first define several custom functions
Code
Copy Code code as follows:
Determines whether an array
function IsArray (v)
{
Return v && typeof
Today, preview the results of tonight, as follows (a little bit, don't throw bricks):
Today, the main design of the next selector, is to enter the game to show the list of games, and then used to select the game of an idiot's function.
The
The eval () function
JavaScript has a number of tips to make programming easier.
One of these is the eval () function, which can execute a string as a JavaScript expression.
As a small example:
Copy Code code as follows:
var
The success of JavaScript is a great relish, writing JavaScript code for Web pages is the basic skill of all web designers, and this interesting language contains many things that are not well known, even for years of JavaScript programmers who have
The code is as follows:
Copy Code code as follows:
function g (n) {
var n = n.tostring (2);
var count = 0;
for (Var i=0;i{
if (n[i] = = "1")
count++;
}
return count;
}
Think this write is very troublesome,
If you really understand how JavaScript functions invoke work, then you can avoid the occurrence of some bugs;
Let's start by creating a simple function that will be used in the following article, which returns only the current value of this and two
Start with the question:
function Base () {}var base = new Base ()
How many objects (object) are created by the above two lines of code?
To answer this question, first clarify the concept of object in JavaScript.
Objects
In JavaScript, almost
The success of JavaScript is a great relish, writing JavaScript code for Web pages is the basic skill of all web designers, and this interesting language contains many things that are not well known, even for years of JavaScript programmers who have
The difference between textcontent and innertext
There is a innertext property under IE, FF has a textcontent attribute. Many of the former to write to IE script, in the FF can not find the innertext attribute, so the internet found the suggestion
Binary Lookup forgetful recursive version
Copy Code code as follows:
function Binary_search (Arr,target,low,high) {
if (Lowvar min= (Low+high)/2;
if (Target>arr[min])
Return Binary_search (Arr,target,min+1,high);
Else
First, the type conversion method and should pay attention to the question:
1.Convert to Boolean:(1) with two-time non-operation(!):!! 5 ==> True(2) with a Boolean constructor:New Boolean (5) = = > TrueValue is converted to a Boolean type ofFalse:0,+
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.