For more information about js writing, see. Var a = false;
! A & alert ("hi ");
If a is interpreted as true, the execution will continue, so hi will pop up.
Var a = a | "hi ";
This explains that when a is false, it will continue to be executed. When a is true, it will jump out of this statement, so we can copy the default value through this method.
Not all languages use this method, such as PHP.
$ A = @ $ a | "hi ";
Echo $ a; // 1
Php assigns a value after (@ $ a | "hi...
$ A = true;
! $ A & echo "hi ";
Direct error: syntax error, unexpected T_ECHO
About prototype
In many cases, we can see that prototype only has objects.
Var add = function () {alert ("B ");}
Add. prototype. a = function () {alert ("hi ");}
New add. prototype.;
First, an error may be reported. Otherwise, when no production object exists, you can directly call the static method by adding. prototype..
JS is misleading.
Selector problems:
Sometimes you need to select a subnode under a node and use childNodes to set the value to FIREFOX. The difference in IE is depressing.
Document. getElementsByTagName ("head") [0]. getElementsByTagName ("script") [0];
The results of the above method are used in the head label phase, but not very useful for other methods.
I think it is better to use a class name.
The Code is as follows:
Function getclassnode (classname, doc ){
Doc = doc | document;
Var node = [], I = 0, j = 0, t;
Var allnode = doc. getElementsByTagName ("*");
While (t = allnode [I]) {
If (RegExp (classname). test (t. className )){
Node [j] = t;
J ++;
}
I ++;
}
Return node;
}
After using JQ, I forgot about all the native JS operations. I occasionally reviewed it and felt very troublesome and depressing.
Make up a note of the JS found today. If a JS has been introduced to the current document, even if the introduced node is removed, the variables and functions defined by the JS file are still valid, because the file has been loaded to the current file environment, the following code:
The Code is as follows:
Document. getElementsByTagName ("head") [0]. removeChild (document. getElementsByTagName ("head") [0]. getElementsByTagName ("script") [0]);