复制代码 代码如下:
his.findElementById = function (identifier, frame) {
if (!frame) {
frame = window;
}
var element = frame.document.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 有的新窗口中frame与老窗口相同。一般是先操作新窗口。从后向前找
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].document.getElementById(identifier);
if (element && element.getAttribute("id") === identifier) {
return element;
}
}
}
}
return null;
};