javascript SharePoint - 隐藏列表分组标题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript SharePoint - 隐藏列表分组标题相关的知识,希望对你有一定的参考价值。
_spBodyOnLoadFunctionNames.push("HideHeaders");
function HideHeaders() {
var elements = getElementsByClassName(document, "td", "ms-gb");
var elem;
for (var i = 0; i < elements.length; i++) {
elem = elements[i];
elem.childNodes[0].childNodes[1].nodeValue = "";
elem.childNodes[1].nodeValue = elem.childNodes[1].nodeValue.replace(':', '');
}
elements = getElementsByClassName(document, "td", "ms-gb2");
for (var i = 0; i < elements.length; i++) {
elem = elements[i];
elem.childNodes[1].childNodes[1].nodeValue = ""; elem.childNodes[2].nodeValue = elem.childNodes[2].nodeValue.replace(':', '');
}
}
function getElementsByClassName(oElm, strTagName, strClassName) {
var arrElements = (strTagName == "*" && oElm.all) ? oElm.all : oElm.getElementsByTagName(strTagName);
var arrReturnElements = new Array();
strClassName = strClassName.replace(/\-/g, "\\-");
var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
var oElement;
for (var i = 0; i < arrElements.length; i++) {
oElement = arrElements[i];
if (oRegExp.test(oElement.className)) {
arrReturnElements.push(oElement);
}
}
return (arrReturnElements)
}
以上是关于javascript SharePoint - 隐藏列表分组标题的主要内容,如果未能解决你的问题,请参考以下文章
JavaScript sharepoint绝对网站集URL javascript变量
如何从SharePoint列表创建javascript数组?
使用 JavaScript 更改 SharePoint 列上的下拉选项值
Sharepoint 2010 在 jquery/javascript 中捕获 webpart 刷新
javascript 获取SharePoint 2010/2013 userID
javascript SharePoint - 隐藏列表分组标题