Consider the following
Code
If (node. nextsibling. classname = ...){...}
If node or node. nextsibling is null, an error is returned ). Therefore, the common solution code is
If (node) & (next = node. nextsibling )&&...){...}
Then, when
Create a script block
Hide scripts
Code
Display when the browser does not support
Hello to the non-JavaScript browser.
Link external script file
Annotation script
// This is a commentDocument. Write ("hello"); // This is a
JS highlight Method 1:
CopyCode The Code is as follows:
liujinzhong liuzhong
JS highlight Method 2:
2.Copy codeThe Code is as follows: test page
liujinzhong liuzhong
Develop cross-browser Javascript
1. Differences between childnodes and IE in ff.
Node (nodetype = 1) in FF are separated by textnode (nodetype = 3), whereas IE/OP is not.
content
In ff, there are three childnodes in box1 and one in IE.
Replace all of them with uppercase or lowercase letters, and then compare them.
The first occurrence of a substring In the indexof object.
Use tolowercase or touppercase
[Ctrl + A select all Note: If you need to introduce external JS, You
A1 = ['020', '021 ',... '025',...];A2 = ['shanghai', 'tianjin ',... Nanjing,...];The length is the same as the length, and corresponds to one by one. How can we get the A2 Nanjing in A1?
I tried a method, but I used a lot of eval and a loop, and I
If you only need to perform operations on the Dom, there is no need to wait until all the pages are loaded. We need a faster method.
Firefox has a domcontentloaded event that can be easily solved. Unfortunately, ie does not.
Msdn's method of JScript
I have been searching for JS bounce for a long time on the Internet
Code And did not find any satisfactory code. So today, I have sorted out the collected bounce code to streamline a very short and powerful JS bounce code, which can break through
1, expression:
The simplest expression: the direct amount or variable name. VaR A = 1;
Value of the direct expression: itself.
Variable expression value: the value that the variable stores or references.
2, operator:Unary operator: for example,-3
The previous lack of in-depth understanding of JavaScript left me helpless.
Later, after the guidance of the two master colleagues (the admiration for these two colleagues is like a continuous stream of rivers and rivers), I suddenly realized that
There are two files: tmh.htm & TT. xml.
Source code As follows:
Tmh.htm
CopyCode The Code is as follows:
new document
// The following is the TT. XML code.
Copy code The Code is as follows: Hai Zi rautinee rautinee@btamail.
1,: eq () and Nth-child ()
See the following:
Code :
2,: Odd and: Even: Odd number of rows: Even: even number of rowsNew users often say that it seems to be the opposite of what we do?In fact, like the eq () selector, the subscript starts from 0,
The following is the question:
The main object of the access control is the document object. Corresponds to all (sub-objects) personal views of the current document. Several methods are provided to access objects.
1. Document. getelementbyid
2.
In IE, we can easily use the following
CodeTo set the Home Page:
Click here to make devdao.com your default homepage!
[Ctrl + A select all Note: If you need to introduce external JS, You need to refresh it to execute]
However, Firefox
1. html of the page
Code As follows:
Argentina Armenia Australia Austria Bosnia and Herzegovina Bangladesh Belarus Belgium Bulgaria Bolivia Botswana Brazil Bulgaria Canada Chile China Colombia Costa Rica Croatia Cuba Czech
JS functions that calculate the character Length
CopyCode The Code is as follows: function Len (STR ){
VaR I, sum = 0;
For (I = 0; I If (Str. charcodeat (I) >=0) & (Str. charcodeat (I) Sum = sum + 1;
Else
Sum = sum + 2;
}
Return sum;
}
JS
retain the original author When referencing, respect any original author, and promote the Internet process in China Editor: Weasle Email: weasle@163.com QQ: 112011531 --> Xmlns = "http://www.w3.org/1999/xhtml">
News 1
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