Js implements the scrolling text effect. On the results display page, you can see that the text is displayed in alternating color. With attractive attention, the effect is really good. After copying the code to your website, it is OK to change it to
1. Add the var keyword when defining jQuery variables.This is not just jQuery. It should be noted in all javascript development processes. Please do not define it as follows:$ Loading = $ ('# loading'); // This is a global definition. If you do not
Method 1:When creating a project, you may need to use js to verify the correctness of the form input. In this case, you need to use the regular expression of js. For example, if you want to verify the month in the format of 'yyyy-mm', this regular
For example:There is such a piece of code:Copy codeThe Code is as follows:Var array = [];Array. push (1 );Array. push (2 );Array. push (3 );For (var I in array ){Console. log (I + ":" + array [I]);}What will be output at this time? Of course it
This function must be integrated into the jquery package.Principle: When the browser moves to a specified position, the layer goes up, and a style is added to position the div layer on the top of the browser.Copy codeThe Code is as follows://
Hover ([over,] out)A method that imitates a hover event (move the mouse over an object and remove it)When you move the cursor over a matching element, the specified first function is triggered.When you move the cursor out of this element, the
In the demand for "loading on demand", we often judge how to judge the completion of Script Loading by returning a callback function when the script is loaded?
We can use onload to determine the loaded JS object (js. onload), this method is
The deeper the location of an identifier in javascript, the slower its read/write speed. Therefore, the fastest reading and writing of local variables in a function, and the slowest reading and writing of global variables. A good rule of thumb is
// This code segment is displayed in IE9, Firefox, Chorme, and safair tests. Some simple styles are added to the table, and basic functions can be implemented. There are still a few issues to be improved!As follows: The following code is used:Copy
The usage of the each function in jquery is similar to that of the map function, but there is still a difference.
An important difference is that each returns the original array and does not create a new array. The map method returns a new array.
false.toString(); // 'false'[1, 2, 3].toString(); // '1,2,3'function Foo(){}Foo.bar = 1;Foo.bar; // 1
A common misunderstanding is that a digital constant cannot be regarded as an object. In fact, a digital constant can still be regarded as an
Use Javascript to get the first two digits of the float decimal point. For example, 22.127456 is used to get 22.13. How can this problem be solved?
1. This method is not recommended at all:
Function get () {var s = 22.127456 + ""; var str = s.
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