The js used in discuz is very good in compatibility and practicability of multiple browsers. We recommend you read var lang = new Array ();
Var userAgent = navigator. userAgent. toLowerCase ();
Var is_opera = userAgent. indexOf ('Opera ')! =-1 opera. version ();
Var is_moz = (navigator. product = 'gecko ') userAgent. substr (userAgent. indexOf ('Firefox') + 8, 3 );
Var is_ie = (userAgent. indexOf ('msie ')! =-1 ! Is_opera) userAgent. substr (userAgent. indexOf ('msie ') + 5, 3 );
Function $
) Function.prototype.call or Function.prototype.apply callis used to specify the pointer to the this object within the function.The difference between call and apply:A) The first parameter of apply specifies the point of the This object, and the second parameter is an indexed collection, which can be an array or an array of classes.var func=function(a,b,c) { alert ([A,b,c]); output [};func.applay](null//null points to the default host object, window in the browser. b) One of the parameters of
[Javascript advanced programming] excerpt 2 Chapter 5 reference type, Chapter 5 javascriptChapter 5 reference types
1. There are two ways to create an Object:
The first is to use the new operator: varperson = new Object ();
The second method is to use the literal representation of the object: var person = {name: 'test'}; (note that the last attribute is not followed by a comma, otherwise, an error may occur
This article describes how to write private attributes in JavaScript. For more information, see $ class. Implement the following functions
1. Inheritance
2. When a subclass inherits the parent class, it does not inherit the private attributes of the parent class.
The Code is as follows:
/*** @ Param {String} className* @ Param {String/Function} superCls* @ Param {Function} classImp*/Function $ class (clas
This article mainly introduces information about the effect of level-2 linkage menus Based on Javascript. For more information, see the examples in this article, the details are as follows:
As follows:
The specific implementation steps are as follows:1. The js Code used is as follows:
Basic native javascript knowledge points (2) review and review, basic javascript knowledgeCommon objects
I mentioned the reference object in the previous lesson and gave a general introduction. Here we will discuss three of them in a little more detail.Object
Object in the form of a key-value pair, which is mainly used for storage and encapsulation.Create object
This article mainly introduces the foldable level-2 menu implemented by JavaScript + CSS, and analyzes the related skills of JavaScript Based on the page element node and style dynamic operations to implement the folding menu in the form of a complete example, for more information, see the examples in this article. We will share this with you for your reference.
Javascript (1) Summary of javascript Array usage (2)
// 1. array sorting. The default value is ascending. The sort () method calls the toString () of each item in the array, and then compares the obtained string to sort the result. // sort (): returns the sorted array // var arr = [23,1, 3,56, 42,-1]; // arr. sort (); // alert (arr); //-, // even if each item in
decimal, octal, or hexadecimal. The expression of the octal number is to add "0" before the number. For example, "0123" indicates that the octal number is "123 ". In hexadecimal notation, "0x" is added: "0xEF" indicates the hexadecimal number "EF ".Float is a "real" type that can store decimals. Data shows that some platforms do not support floating-point variables stably. Do not use the floating point type if you do not need it.String type is a stri
This article mainly introduces the implementation of the provincial/municipal level-2 linkage drop-down menu based on javascript, which has some reference value, interested friends can refer to the examples in this article to share with you the code for implementing the level-2 linkage drop-down menu in js for your reference. The details are as follows:
Js Code:
This article describes how to create a level-2 cascading menu in javascript. For more information, see the examples in this article. Share it with you for your reference. The details are as follows:
The running effect is as follows:
The Code is as follows:
decimal, octal, or hexadecimal. The expression of the octal number is to add "0" before the number. For example, "0123" indicates that the octal number is "123 ". In hexadecimal notation, "0x" is added: "0xEF" indicates the hexadecimal number "EF ".Float is a "real" type that can store decimals. Data shows that some platforms do not support floating-point variables stably. Do not use the floating point type if you do not need it.String type is a stri
more easily, but also you will soon remember the role of the variable when you want to modify the program later. Variable names are generally lowercase, and if they are made up of multiple words, the first word is lowercase and the first letter of the other word is capitalized. For example: MyVariable and myanothervariable. This is done only for the sake of beauty and readability, because JavaScript commands (the word "command" in a more specific way
There are too many strings. Continue to talk!
1. Convert all string content to lowercase letters
[Javascript]Var txtString1 = "PrimitiveJavaScript is my JavaScript Special column .";Document. write ("Result:" + txtString1.toLowerCase (); // The toLowerCase () method is used to convert the string to lowercase.
Var txtString1 = "PrimitiveJavaScript is my JavaScript
) means that JavaScript is running in the browser instead of on the server side. After the Web page is delivered by the server and loaded by the browser, client script allows the user to interact with the Web page. Google maps, for example, uses JavaScript language to support the interaction between users and maps, moving maps, zooming in and out of the interactive way. Without
variable for the first time Variables are not declared and are directly assignable, and as a new global variable by default, avoid using global variables as much as possible.2 Use = = = = = = The = = and! = operators automatically convert data types when needed. but = = = and!== do not, they compare values and data types at the same time, which makes them faster than = = and! =.3underfined, NULL, 0, False, NaN, empty string logical result is False un
; Suppose 2:opacity is not a unit
Modify 1: Add a judgment, when the incoming value is opacity, we execute the parsefloat, the code is as follows:
var icur = 0;
if (attr = = ' opacity ') {
icur = parsefloat (GetStyle (obj,attr)) *100;
} else{
icur = parseint (GetStyle (obj,attr));
}
Modify 2: Add one more judgment
if (ITarget = = icur) {
clearinterval (obj.timer);
}
else{
if (at
There are too many strings. Continue to talk! 1. Convert all string content to lowercase [javascript] vartxtString1 quot; PrimitiveJavaScriptismyJavaScriptSpecialcolumn. quot; document. write ( quot; Result: quot; + txtString1.toL
There are too many strings. Continue to talk!
1. Convert all string content to lowercase letters
[Javascript]Var txtString1 = "PrimitiveJavaScript is my
keyword, and then assigns the result of 1 + 2 to variable. Note that the = symbol is not equivalent to an equal sign in JS, but a value is assigned. For example: alert ('hello'); this is a JS statement. The end of a row is regarded as the end of the statement. Generally, A; is added at the end to indicate the end of the statement, if multiple lines of JS statements exist and each sentence ends, the statements are executed in order. Note: The Code and
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.