Recently, I am working on a multi-File Upload component, which has been implemented in IE and can be used to dynamically add uploaded attachments. however, in the next test of FF, no response was found. I used insertadjacenthtml. no way. note that there is an insertadjacenthtml method compatible with FF in ext2. copy the file.
<SCRIPT type = "text/JavaScript">
<! --
Function inserthtml (where, El, HTML ){
Where = where. tolowercase ();
If (El. insertadjacenthtml ){
Switch (where ){
Case "beforebegin ":
El. insertadjacenthtml ('beforebegin', HTML );
Return El. previussibling;
Case "afterbegin ":
El. insertadjacenthtml ('afterin in', HTML );
Return El. firstchild;
Case "beforeend ":
El. insertadjacenthtml ('foreend', HTML );
Return El. lastchild;
Case "afterend ":
El. insertadjacenthtml ('afterend', HTML );
Return El. nextsibling;
}
Throw 'illegal insertion point-> "'+ where + '"';
}
VaR range = El. ownerdocument. createRange ();
VaR frag;
Switch (where ){
Case "beforebegin ":
Range. setstartbefore (EL );
Frag = range. createcontextualfragment (HTML );
El. parentnode. insertbefore (frag, El );
Return El. previussibling;
Case "afterbegin ":
If (El. firstchild ){
Range. setstartbefore (El. firstchild );
Frag = range. createcontextualfragment (HTML );
El. insertbefore (frag, El. firstchild );
Return El. firstchild;
} Else {
El. innerhtml = HTML;
Return El. firstchild;
}
Case "beforeend ":
If (El. lastchild ){
Range. setstartafter (El. lastchild );
Frag = range. createcontextualfragment (HTML );
El. appendchild (frag );
Return El. lastchild;
} Else {
El. innerhtml = HTML;
Return El. lastchild;
}
Case "afterend ":
Range. setstartafter (EL );
Frag = range. createcontextualfragment (HTML );
El. parentnode. insertbefore (frag, El. nextsibling );
Return El. nextsibling;
}
Throw 'illegal insertion point-> "'+ where + '"';
}
Parameter introduction:
Where: insert position. Includes beforebegin, beforeend, afterbegin, and afterend.
El: Used to reference the HTML element object at the inserted position
HTML: the HTML code to insert
Everything is OK.
I 've been looking at ext Resources recently and have gained a lot. If you are interested, please take a look.