The demo address below is partial gray
Partial gray demo address: http://demo.jb51.net/js/grayscale/index.htmlFull gray demo address: http://demo.jb51.net/js/grayscale/demo2.htmUsage:
1. first introduce the grayscale. js file to the webpage.2.
Return (array) borwser
For example, if the current browser type is ie6.0, The bortings value should be ["ie", "6", "6.0"]
The first value of the array indicates the type of the browser, the second value indicates the large version of the browser,
1. stingy with you
Code , With the least code to do the most appropriate thing;
For example, if you use document. getelementbyid () in your code, do you want to write a simple ID selector?
Copy code The Code is as follows: function $ (ID)
{
Return
I opened the firebug console and spent 30 seconds thinking, writing 30 seconds. The result is as follows: (x is the target array, and Y is the result after repeated elements are removed)
CopyCode The Code is as follows: var x = [1, 1, 3, 4, 5,
The conversion rules are as follows: If the type of an operand is Boolean, convert it to numeric type first, convert false to 0, and convert true to 1.
If one of the operands is a string and the other is a number, convert the string to a number for
The script can be placed in the head of the HTML page or in the body.
Put the script in the body. When the browser encounters the
merge script because the script download blocks page rendering, you should reduce the use of the
Definition and usage
The tofixed () method rounds a number to a specified number of decimal places.
Syntax Numberobject. tofixed (Num) num is required. Specifies the number of digits in a decimal place, ranging from 0 ~ Values between 20,
There are two main parameters: the first is to set the text to be copied, and the second is to copy the specific content, which can be obtained from the text box or using innerhtml.
Simple instance
Code:
Copy codeThe Code is as follows:
Note:
There are multiple methods to implement inheritance in Javascript. The following two are common methods.
1. Call inheritance. First readCode: First define a "person" ClassCopy codeThe Code is as follows: // humanPerson = function (){This. Name =
For example, date. parse ("2000-01-01") IE and Mozilla Browser: "Nan ". Therefore, we generally cannot directly convert the display time on the web page. Processing is required.
Formats that can be directly converted: "01/01/2000", "2000/01/01"
JavaScript does not have the namespace concept, but it must reflect the object-oriented idea,
There should be namespaces, just like the package in Java and the namespace in. net,
To prevent class name conflicts, the same class names do not conflict
All the functions you create are case sensitive.
Single quotation marks ('string') and double quotation marks ("string") are no special differences in JavaScript and can be used to create strings. however, as a general principle, most web developers
1. Differences between event streams
Ie uses bubble events Netscape uses capture events Dom uses capture first and then bubble eventsExample:CopyCodeThe Code is as follows: click here
Bubble event model: button-> div-> body (ie event
In general, & | is relatively simple. We will not discuss it here.
Prepare two objects for the following discussion.
CopyCode Code: var Alice = {
Name: "Alice ",
Tostring: function (){
Return this. Name;
}
}
VaR Smith = {Name: "Smith
I. Introduction
Asynchronous JavaScript and XML (Ajax) are special terms used to implement data interaction between client scripts and servers. The advantage of this technology is that it provides developers with a way to retrieve data from the
// Add a method for the constructor prototype
Function. method = function (name, func ){
This. Prototype. Name = func;
}
Number. Method ("integer", function (){Return math [This });(-10/3). INTEGER (); //-3
String. Method ("trim", function
The test is as follows:
Array type testObject Type TestTest the instantiation function.Test the function parameter passing by address
var a = B = [1, 2]; . push (3); alert (. length + ':' + B. length);
Impact on Node object operations:
This may sound a little messy. Don't worry. I will explain this special method through the example below:
First, we need to first understand the concept of a class. JavaScript itself is an object-oriented language, and its elements depend on a
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