An instance of memory release
The code is as follows
Copy Code
CollectGarbage, a unique property of IE, used to free memoryUse the method should be, the variable or reference object, set to null or deleteAnd
1. Countdown to the end of the world
The code is as follows
Copy Code
from 2012 Doomsday and:
2. Hour countdown, can be used for online exams
The code is as follows
Copy Code
Order of singular groups
Sort () function
The sort method of an array object can rearrange the array elements in a certain order. Usually, they are arranged in the order of subtitles. When sort () is used, the comparison function is executed each
Example we're going to bind a carriage return event
The code is as follows
Copy Code
$ (function () {Define carriage return Eventsif (Document.addeventlistener) {//if it is FirefoxDocument.addeventlistener ("KeyPress",
One, array
1. Define one-dimensional array: var s1=new array ();
The code is as follows
Copy Code
s1=[1,2,3,4] or s1[0]=1,s1[1]=2,s1[3]=3,s1[4]=4;
Alert (s1[0]);
The result was 1;
The code is as
Project development often need to use JS to determine whether a picture is loaded successfully, if the picture loaded successfully, then execute its corresponding onload binding event,
This is what we call the picture preload technology, first on
However, in the verification standard of the target=, the "_blank" attribute is not validated.
The reason is that those who think of the brick to open a new window without the consent of the user, such behavior belongs to strong X user's thought.
Javascript Follow Plugin
Js following scrolling effect plugin
Support for defining multiple follow IDs, using CSS fixed attributes, not supporting IE6, and compatible with other mainstream browsers.
Support defines the minimum height of scrolling
Get Lunar calendar
The days of the lunar calendar are a variable, sometimes 29 days, sometimes 30 days.
The first day of the lunar calendar is the day when the moon is All black.
The Lunar New Year is determined by the 24 solar terms, which are
1. Rounding
The following two functions can be rounded to the floating-point number, reserving two digits after the decimal point.
/** the following two functions can be rounded to the floating-point number, retaining two digits after the decimal
There are four main methods of event binding for JavaScript (one that works in IE but does not guarantee other browsers):
[Note: OnXxx for an event, fun for a function,domid for a DOM object Id,event type is shown in the appendix below. ]
1, in
Web effects four dynamic display of time date code in Web pagesDisplaying the date time in a Web page is more commonly used, and I've collected four display methods that I hope will help a lot.
Take the parts and make a string connection
code
Use when you link to
Location.replace (URL) ">JavaScript Mask main Window scroll bar
Add it to the body tag.Style= "Overflow-y:hidden"JavaScript screen screen, constantly emptying clipboardAdd it to the body tag.Onload= "SetInterval ('
How to write a Switch statement.JavaScript Switch StatementIf you want to choose to execute one of several blocks of code, you can use the switch statement:Grammar:Switch (n){Case 1:Execute code block 1BreakCase 2:Execute code block 2BreakDefaultIf
Tip: you can modify some code before running Leisure and EntertainmentFood & BeverageConvenient lifeTravelShopping WorldEducation and TrainingDecorationAutomotive WorldOther categoriesMerchants enter more merchantsBeijing Hua Xu digital
Html5 is widely used. To improve user experience, some html5 is often added to webpages. When users browse our websites, js checks whether the browser can support html5, then, give the user a prompt and guidance.Method 1:If (typeof (Worker )! =
Object-oriented language has three features: encapsulation, inheritance, and polymorphism. Js beginners generally think that JavaScript is the same as other C languages. Keywords like Class can help us better perform object-oriented operations in js.
Circular dependency indicates that the execution of script a depends on Script B, and the execution of Script B depends on script.// A. jsVar B = require ('B ');// B. jsVar a = require ('A ');In general, "Loop loading" indicates strong coupling. If
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