1. innerhtml is highly efficient in creation and fast in Dom operation and Deletion
2. the DOM structure cannot be changed if the file loading is incomplete.
Document. onmousedown = function (){
VaR html = "";
For (VAR I = 0; I <10; I ++ ){
HTML + = "<p>" + math. Random () + "<p> ";
} Var temp = Document. createelement ('div ');
Temp. innerhtml = HTML;
VaR frag = Document. createdocumentfragment ();
(Function (){
If (temp. firstchild ){
Frag. appendchild (temp. firstchild );
SetTimeout (arguments. callee, 0 );
} Else {
Document. getelementsbytagname ('div ') [0]. appendchild (frag );
}})();};
Function replacehtml (El, HTML ){
02 var oldel = typeof El = "string "? Document. getelementbyid (EL): El;
03/* @ cc_on // innerhtml alone will be a little faster in IE
04 oldel. innerhtml = HTML;
05 return oldel;
06 @*/
07 var newel = oldel. clonenode (false );
08 newel. innerhtml = HTML;
09 oldel. parentnode. replaceChild (newel, oldel );
10/* because we only remove the old element from the Dom, a new element reference is returned for restoration */
11 return newel;
12 };