js实现的捐赠管理完整实例(7)

//给上一页绑定事件 
            gel("btnprePage").onclick = function() { 
               if (pageNow > 1) { 
                   pageNow--; 
                   showPage(); 
               } else { 
                   alert("已经是第一页!") 
               } 
            }; 
            //给下一页绑定事件 
            gel("btnnextPage").onclick = function () { 
                if(pageNow<listData.length/pageSize) 
                { 
                    pageNow++; 
                    showPage(); 
                }else 
                { 
                    alert("已经是最后一页!"); 
                }  
            };  
        }; 
        var pageNow = 1; 
        var pageSize = 5; 
        function showPage() { 
            var trs = gel("tbList").rows; 
 
            for (var j = trs.length - 1; j > 0; j--) { 
                gel("tbList").deleteRow(j); 
            } 
 
            //1.根据pageNow和pageSize返回一个数组 
            var res = listData.fenyeQuery(pageNow, pageSize); 
            for (var i = 0; i < res.length; i++) { 
                addRow(res[i]); 
            } 
        } 
    </script> 
</head> 
<body> 
    <div> 
        <h1>捐赠管理</h1> 
        <div> 
            受捐单位 
            <select> 
                <option value="-1">--请选择--</option> 
            </select> 
            <input type="button" value="查询" /> <input type="button" value="上一页" /> <input type="button" value="下一页" /><span></span> 
        </div> 
        <div> 
            捐赠人:<input type="text" size="8" /> 
            受捐单位: 
            <select> 
            </select> 
            金额:<input type="text" size="8" /> 
            受捐日期:<input type="text" size="10" /> 
            <input type="button" value="新增" />
        </div> 
        <table cellspacing="0" cellpadding="0"> 
            <tr> 
                <td>序号</td> 
                <td>捐赠人</td> 
                <td>受捐单位</td> 
                <td>金额</td> 
                <td>受捐日期</td> 
                <td>操作</td> 
            </tr> 
        </table> 
    </div> 
</body> 
</html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgxwww.html