Private Method: A private method can be set to all the attributes inside the category, that is, private and public attributes. However, private methods cannot be called outside the class.
Private method Syntax:CopyCodeThe Code is as follows:
That's why this function is not provided in Js?
Currently, all browsers parse Js in the UI thread. Taking Firefox as an example, I re-compiled the JS engine and added the sleep method to the JS alert. This method is called.C LanguageThread sleep
But sometimes, when an event is triggered, we need to do some operations first and then jump. At this time, we need to use JavaScript to implement this jump function.
The specific practices are as follows:
1. Jump to the new page and open it in the
CopyCodeThe Code is as follows: function $ (ID) {return document. getelementbyid (ID );
The previous version of the browser is no problem, if you use an old browser, you can use the following functionCopy codeThe Code is as follows: function $
CopyCode The Code is as follows: var foreach = (function (){
// Array and pseudo array Traversal
VaR _ array_foreach = function (array, block, context ){
If (array = NULL) return;
// Special processing of string
If (typeof array = 'string '){
Array =
Let's take a look.
Code (Supports multiple class queries and queries within a certain range)
Copy code The Code is as follows :/*
* Obtain the Element Set Based on the element clsssname.
* @ Param fatherid the ID of the parent element. The default
I believe most people may want to learn javascript here, but they still want to use it to combine the DOM elements on the page for some practical and useful interaction effects. So here I will only teach you the most practical and useful javascript
DateAdd function:
Copy codeCode: function DateAdd (interval, number, date ){
Switch (interval. toLowerCase ()){
Case "y": return new Date (date. setFullYear (date. getFullYear () + number ));
Case "m": return new Date (date. setMonth (date. getMonth
How complicated is event? It can be seen how the best addEvent came into being six years ago, and jQuery paid more than one thousand six hundred lines of hard-earned code (v 1.5.1) after six years, the browser with various cores is ready.
I tried
Preload and JavaScript Image () Objects
Many high-res images can make the Web site more clean and tidy. However, they also slow the Website access speed-the image is a file, the file uses the bandwidth, and the bandwidth is directly related to the
3.1 Basic Data Types
1. string type (string): it consists of unicode characters, numbers, and punctuation marks. In javascript, there is no char character type. A string must be used even if it only represents one character.
2. number: the integer
I encountered a small problem today. During DOM construction, IE cannot pass element. setAttribute ('name', _ variable); and element. name = _ variable; this form adds the name attribute to the element, whether it is IE6 or IE7. (IE8 is acceptable,
The function is as follows:
Copy codeThe Code is as follows: foreach = function (obj, insp ){
If (obj = null & obj. constructor! = Array ){
Return [];
}
// Obj is the array to be processed. obj = null indicates that the object does not exist. obj.
1. shift: Delete the first entry of the original array and return the value of the deleted element. If the array is empty, undefined is returned.
Var a = [1, 2, 3, 4, 5];
Var B = a. shift (); // a: [2, 3, 4, 5] B: 1
2. unshift: add the parameter
Test.htm
Copy codeThe Code is as follows:
array-remove-repeate
Watch. jsCopy codeCode: var Watch = {Result: [],Guid:-1,TotalTime: 0,Start: function (title ){This. result [++ this. guid] = [title | this. guid, new Date (). getTime
Instructions: Move Up, down, left, right, and left with spaces. Each time an attacker hits an enemy plane, an increase of 100 points means that the number of rounds of a player's plane increases by one to four points, if it is hit by an enemy plane
Let's look at a simple Javascript debugging package: jscript. debug. js contains two functions. The first is used to traverse each attribute of an object; the second is a general Debug function (in fact, 'object' is more 'accurate ), it is used to
The limit is an integer.
Copy codeThe Code is as follows:
CheckNumber
Restricted to currencyCopy codeThe Code is as follows: // Trigger the eventOnblur = "checkMoney (this )"
Start with question:
Function Base () {} var base = new Base ()How many objects will the above two lines of code create )?
To answer this question, first clarify the concept of objects in Javascript.
Objects
In Javascript, almost everything is an
Document directory
Press any key ....
The KeyCode value collected on the internet is convenient for you to find:
Keycode 8 = BackSpaceKeycode 9 = TabKeycode 12 = ClearKeycode 13 = EnterKeycode 16 = Shift_LKeycode 17 = Control_LKeycode 18 =
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