当前位置: 代码迷 >> JavaScript >> JavaScript批改报表翻页
  详细解决方案

JavaScript批改报表翻页

热度:145   发布时间:2012-09-17 12:06:51.0
JavaScript修改报表翻页
3、css控制报表上下翻页样式,将这段js代码放到表脚

<script type="text/javascript">
function changePageStyle()
{
    var container = document.getElementById('CVNavLinksRS');
    if (container == null)
    {
        container = document.getElementById('CVNavLinks_NS_');
    }
   
    if (container == null)
    {
          window.setTimeout(changePageStyle, 100);
          return;
    }

    var tables = container.getElementsByTagName("table");
    var pageTable = tables[0];
   

    if (pageTable == null)
    {
          window.setTimeout(changePageStyle, 100);
          return;
    }
    pageTable.parentNode.align="right";  

    var tdList= pageTable.getElementsByTagName("td");
    var styleArray = [
         ['first_false','first_true',''],
         ['previous_false','previous_true','上一页'],
         ['next_false','next_true','下一页'],
         ['last_false','last_true','']
    ];
    var styleIndex = 0;
    for (var index = 0; index < tdList.length; index++)
    {
        var oTd = tdList[index];
        if (index % 2 == 0)
        {
            oTd .innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;";
        }
        else
        {
            if (/&nbsp;/.test(oTd.innerHTML))
            {
                oTd.innerHTML = oTd.innerHTML.substring(0, oTd.innerHTML.length - 6);
            }
            var aList = oTd.getElementsByTagName("a");
            if (aList.length == 1)
            { 
                aList[0].innerHTML='<input type="button" style="color:#000000" value="' + styleArray[styleIndex][2] + '" class="' + styleArray[styleIndex][1] + '" />';
            }
            else
            {
                oTd.innerHTML = '<input type="button" style="color:#cccccc" value="' + styleArray[styleIndex][2] + '" class="' + styleArray[styleIndex][0] + '" />';
            }
            styleIndex++;
        }
     }
     pageTable.parentNode.style.backgroundColor="#E7E8EC";
     if (pageTable.style.setProperty)
     {
         pageTable.style.setProperty("visibility","visible", "important");
     }
     else
     {
         pageTable.style.visibility = "visible";
     }
}
window.setTimeout(changePageStyle, 10);
</script>
<script>
function aa()
{
  alert(111);
  //var divMenu = getCV().rvMainWnd.getContextMenu();

 
  window.oCVRS.rvMainWnd.getContextMenu().getGoToMenuItem().remove();
  alert(window.oCVRS.rvMainWnd.getContextMenu().getGoToMenuItem().getLabel() + ":" +window.oCVRS.rvMainWnd.getContextMenu().getGoToMenuItem().getAction());
}

</script>
  相关解决方案