crm 4 IFRAME 元素隐藏

时间:2025-01-24 16:05:08
function hidebtn(elementTitle) {
var x = document.getElementsByTagName("LI");
for (i = 0; i < x.length; i++) {
if (x[i].title == elementTitle) {
x[i].outerHTML = '<LI class="ms-crm-Menu" title =\"' + elementTitle + '\"><SPAN><SPAN><SPAN></SPAN></SPAN></SPAN></LI>'
}
}
} function HideViewButtons(IframeIdName, buttonTitles) {
var Iframe = document.getElementById(IframeIdName);
if (Iframe != null) {
Iframe.onreadystatechange = function HideTitledButtons() {
if (Iframe.readyState == 'complete') {
var iFrame = frames[window.event.srcElement.id];
var liElements = iFrame.document.getElementsByTagName('li');
for (var j = 0; j < buttonTitles.length; j++) {
for (var i = 0; i < liElements.length; i++) {
if (liElements[i].getAttribute('title') == buttonTitles[j]) {
liElements[i].style.display = 'none';
break;
}
}
}
}
}
}
}
function HideViewButtons(IframeIdName, elementsId) {
var Iframe = document.getElementById(IframeIdName);
if (Iframe != null) {
Iframe.onreadystatechange = function HideTitledButtons() {
if (Iframe.readyState == 'complete') {
var iFrame = frames[window.event.srcElement.id];
var mnuBarElements = iFrame.document.getElementById(elementsId);
if(mnuBarElements!=null)
{
mnuBarElements.style.display = 'none';
} }
}
}
}

iframe 加载完成之后执行相关操作.

调用方法如下:

HideViewButtons('IFRAME_log', ['title1','title2','导出到 Excel 工作表','打印预览','邮件合并','删除', '分派','其他动作']);