日期:2014-05-16  浏览次数:20402 次

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++;
     &nb