indexOf
Returns the index of the element in the array, and returns-1. Similar to the IndexOf method of string.
If other browsers do not implement this method, you can implement compatibility with the following code:
Copy Code code as follows:
1. Do you really know the sort method in JavaScript?
2. Do you know the function body of the Localecompare method in JavaScript?
3. What are the parameters of the table sorting method?
The sort method in JavaScript directly provides the function of
One, what are the types and usage of closures and closures &NBSP 1, what is a closure closure, The official explanation for closures is that an expression (usually a function) with many
1, what is closure
Closures are functions that have access to variables that are scoped to another function.Simply put, JavaScript allows the use of intrinsic functions---i.e. function definitions and function expressions in the function body of
Look at the code:
Html:
Copy Code code as follows:
index
1
2
3
4
Index.js content:
Copy Code code as follows:
/*
Author:binarytree
*/
Fill a local reference to a picture
There are many reasons why you can add a drag-and-drop function to your page, the simplest reason being to rearrange the data. For example, you might want users to be able to reorganize a series of page elements by placing an input or select
First, briefly introduce some of the methods for attributes:
Enumeration of attributes:
A for/in loop is a way of traversing an object's properties. Such as
Copy Code code as follows:
var obj = {
Name: ' Obj1 ',
AGE:20,
Height:
This article illustrates the concept and usage of JavaScript function throttling. Share to everyone for your reference, specific as follows:
Recently in the Web page when there is a need, is the browser window changes need to change some of the
The main use of the Location object, containing information about the current URL, is a part of the Window object that can be accessed through the Window.location property.
Method One (Window.document.location.href/window.document.location.pathname)
From then on, I have done a lot of research on these methods and have used them on many occasions. In many tasks, they are proven to be very useful (especially with regard to the abstract DOM selector of the structure).1, Domelement.contains
Create a random number
① since JavaScript, many browsers have built-in random number generation methods. For example:
var number = Math.random ();
This method produces a floating-point number between 0 and 1.
② is based on time and can also produce
One, what is an anonymous function?
There are generally three ways to define a function in javascript:
functions keyword (function) statement :function fnMethodName(x){alert(x);}
functions literal (function literals):var fnMethodName
Just learned the operation methods and properties of the DOM node tree, while trying to write a not manually set the ID and double-click the event example, toss the n long time finally made a touch of the sample, the code is as follows: (Note:
Why not textarea it?
1 not highlighted
The 2 Tab key is not available. --Press the TAB key to switch to the next control
3 No code formatting. -because you are accustomed to the eclipse environment, you can use CTRL+SHIFT+F to format the code.
The day before yesterday I made a piece of paper [a line of code easy to handle the express message function], At the same time the release of the V1.0beta version of the Quick Message function and source code, the reason is beta, is the feeling
Dom adding elements, using node properties
dom add elements, using node properties item 1
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
First, Dom Basics
1. Nodes (node)
If there is a Fibonacci sequence to calculate:
Copy Code code as follows:
var Fibonacci = function (n) {
return N };
I'm afraid the number one big browser will collapse, because the operation of the function will have a lot
One, what is the prototype property of the object in JavaScript JavaScript, the prototype property of the object that is used to return the reference to the object type prototype. We use the prototype property to provide a set of basic functions
Relatively simple, for example: There is a region
Copy Code code as follows:
var Divpanel = document.getElementById ("Newbody");
var controlinfo= divpanel.childnodes;
for (var index = 0;index {
Divpanel.removechild (Controlinfo[
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
The more straightforward test code is:
Alert (test ("ID number"));
After testing, the above JS verification is too strong, the input of the correct ID card,
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.