Copy codeThe Code is as follows:
His. findElementById = function (identifier, frame ){
If (! Frame ){
Frame = window;
}
Var element = frame.doc ument. getElementById (identifier );
If (element & element. getAttribute ('id') === identifier ){
Return element;
}
// Else if (browserVersion. isIE | browserVersion. isOpera ){
/// SEL-484
// Var xpath = '/descendant: * [@ id =' + identifier. quoteForXPath () + ']';
// Return this
//. FindElementByXPath (xpath );
//}
Else {
// MOD 2011-12-9 some new windows have the same frame as old windows. Generally, a new window is operated first. Forward from the back
If (frame. frames & frame. frames. length> 0 ){
For (var I = frame. frames. length-1; I> = 0; I --){
Element = this. findElementById (identifier, frame. frames [I]); // frames[ I }.doc ument. getElementById (identifier );
If (element & element. getAttribute ("id") === identifier ){
Return element;
}
}
}
}
Return null;
};