在sharepoint 2010的页面中,我们在页面的最上方,有一条深灰色的Ribbon工具栏,如下图,这里可以通过下面的脚本,做一些脚本,来控制它的隐藏和显示。
最后把这些脚本,放在v4.master母板页的<div id="s4-workspace"></div>这个标签里面。
<div style="background-color: gray;text-align: right">
<input type="button" id="hideRibbon" value="显示" onclick="HideRibbonFunc()"/>
<wssuc:welcome id="IdWelcome" runat="server" enableviewstate="false">
</wssuc:welcome>
<wssuc:muiselector id="IdMuiSelector" runat="server" />
<style>
.ms-welcomeMenu a:link
{
/* [ReplaceColor(themeColor:"Light1",themeTint:"0.9")] */
color: white;
}
.ms-welcomeMenu.ms-SpLinkButtonActivea:link
{
/* [ReplaceColor(themeColor:"Light1",themeTint:"0.9")] */
color: white;
}
</style>
</div>
<script>
function HideRibbonFunc() {
var ribbonrowObj = document.getElementById("s4-ribbonrow");
if (ribbonrowObj.style.display =="none") {
document.getElementById("hideRibbon").value ="隐藏";
ribbonrowObj.style.display = "";
}
else {
document.getElementById("hideRibbon").value ="显示";
ribbonrowObj.style.display = "none";
}
}
</script>