Later found that such a document is very inconvenient to view, and listen to our boss said Phper can generate their documents, I think JS will also have a, so ... You know... Through the @ Guangzhou ♂lxrmido know JSDoc, so GitHub down on down;
The judgment of 1.typeof, constructor and instanceof in the log group
The code is as follows
Copy Code
var arr = [1,5,6,9,8,5,4];var arr = new Array (1,5,6,9,8,5,4);Console.log (typeof arr);//objectConsole.log
Get the displayed Kanjidocument.getElementById ("Bigclass"). Options[window.document.getelementbyid ("Bigclass"). SelectedIndex].textGetting IDs in the databaseWindow.document.getElementById ("Bigclass"). ValueGets the index ID of the select Group
Oh, for a long time did not write articles, the recent contact with JS compare how long by the way to write a JS-related article.
Well, thank you today for variables related to it, variable this thing as long as you are knocking on the code every
Sometimes, when doing web development, it is commonly used. There are more than one way to see how many you have mastered?
Common ways to refresh pages
History.go (0)Location.reload ()Location=locationLocation.assign (location)Document.execcommand
An HTML string is a string with an HTML special symbol such as ' aklsdjfklsjdfl ', which we usually have to process and then output to prevent the output from being a true HTML element, which is the
If the string is very long and there are a lot
Cookies are browsers (user agents) access to a number of Web sites, these sites are stored in the client's set of data, used to make Web sites such as tracking users, implementation of user-defined features.
The domain and path properties of the
The solution that comes to mind is:
The code is as follows
Copy Code
Content.replace (/]*src=[']] ([^ ' "]+) [^>]*>/gi, function (match) {Console.log (match);});The output results are:
Get the entire IMG tag,
One, array
(1) Detection array
For a global scope, you can use the instanceof operator to detect whether an object is an array:
The code is as follows
Copy Code
if (value instanceof Array) {//}
However, if
typeof methods, such as:
The code is as follows
Copy Code
However, the method does not work as we think in some browsers.
1, Firefox2 and Firefox3In both browsers, the type of HTML object element is detected
Keep in mind that cookies are a string property of a document. To save a cookie, simply create a string, the format is name= (name = value), and then set the document's Document.cookie to be equal to it. For example, if you want to save the user
Call methodPlease seeApply to: Function ObjectRequirementsVersion 5.5Invokes one of the object's methods to replace the current object with another object.
Call ([thisobj[,arg1[, arg2[, [,. argn]]]]ParametersThisobjOptions available. The object
Summary of Web page effects browser compatibility code
Not necessarily all, and some may not be accurate, such as the new IE8, chrome, etc. are not too much involved, although some recent projects have been compatible with IE8, chrome and so on,
can only enter Chinese
The code is as follows
Copy Code
Can only enter Chinese ================//
The code is as follows
Copy Code
if (type== "R_china"){if (Value.search (/^[/u4e00-
1. JavaScript code should conform to Douban-jslint inspection standard
1-1. Statements must have a semicolon ending, except for, function, if, switch, try, while
1-2. Only long statements can consider breaking, such as:
The code is as
The code is as follows
Copy Code
function CheckValue (){if (isNaN (Document.all.textbox.value)){Alert ("Please use digital input!") ");return false;}}
Cases
InstanceIn this case, we'll use Isfinite () to detect infinite
Web Storage in html5 includes two Storage methods: sessionStorage and localStorage.SessionStorage is used to locally store data in a session. The data can be accessed only on pages in the same session. When the session ends, the data is also
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.