function main(spreadsheetReport) {
var elemSheetFrame = spreadsheetReport.elemSheetFrame;
changeStyle(spreadsheetReport, elemSheetFrame);
}
function changeStyle(spreadsheetReport, elemSheetFrame) {
if (elemSheetFrame && elemSheetFrame.contentWindow) {
var elems = elemSheetFrame.contentWindow.document.getElementsByTagName("A");
for (var i = 0; i < elems.length; i++) {
var elem = elems[i];
if(elem.firstChild != null && (!isNaN(elem.firstChild.innerText) || !elem.getAttribute("href"))) {
continue;
}
// 设置点击跳转前的字体颜色和下划线
//设置字体颜色
elem.firstChild.style.color = "#2248DD";
//设置下划线颜色
elem.style.color = "#2248DD";
//隐藏下划线
elem.style.textDecoration = "none";
if (elem.firstElementChild) {
elem.firstElementChild.style.textDecoration = "none";
}
if (elem.parentElement) {
elem.parentElement.style.textDecoration = "none";
}
// 设置点击跳转后的字体颜色和下划线
spreadsheetReport.addListener(elem, "click",
function() {
this.firstChild.style.textDecoration = "underline";
this.firstChild.style.color = "#716699";
});
//鼠标移入时设置单元格背景色
var c = elem.parentNode;
spreadsheetReport.addListener(c, "mouseover",
function() {
this.style.backgroundColor = "#ff0000";
},
c);
// 鼠标离开时设置单元格背景色
spreadsheetReport.addListener(c, "mouseout",
function() {
this.style.backgroundColor = "#FFF2CC";
},
c);
}
var doc = elemSheetFrame.contentWindow.document;
var list = doc.getElementsByTagName("IFRAME");
for (var i = 0; i < list.length; i++) {
function x(subIFrame) {
changeStyle(spreadsheetReport,subIFrame);
subIFrame.onload = function() {
changeStyle(spreadsheetReport,subIFrame);
};
};
x(list[i]);
}
}
}