Js 分页类 (适合Ajax分页用)
调用方法如下:
var p = new Pager(5, 10);
p.init('页码所在的容器ID', dataOp);
function dataOp() {
// ajax数据操作
SendContent("/Admin/TopicService.asmx/GetTopicList?currentPageIndex=" + p.currentPage + "&pageSize=" + p.pageSize, "GET", "", ajax postback method);
}
JS代码如下:
// ==============================================================================
// Created by Bndy at 2010/3/18
// Copyright (c) 2010 ahdzlc, All rights reserved.
//
// * * * * * * * * * * * * * * * *
// * Q Q : 8 1 7 9 5 7 0 5 *
// * M S N : bndy533@msn.com *
// * Email : bndy533@163.com *
// * * * * * * * * * * * * * * * *
//
// ------------------------------------------------------------------------------
// JS 分页函数
// 适合Ajax分页时使用
// ==============================================================================
var pager;
var handler;
var Pager = function(totalRecordCount, pageSize) {
this.pageSize = pageSize;
this.currentPage = 1;
this.totalPageCount = totalRecordCount % pageSize != 0 ? Math.floor(totalRecordCount / pageSize) + 1 : Math.floor(totalRecordCount / pageSize);
var ele;
this.getBeginPageNum = function() {
if (this.pageSize > this.totalPageCount) {
return 1;
}
if (this.currentPage > this.totalPageCount) {
return this.totalPageCount - this.pageSize + 1;
}
else {
return Math.floor((this.currentPage - 1) / this.pageSize) * this.pageSize + 1;
}
};
this.getEndPageNum = function() {
var x = Math.floor((this.currentPage - 1) / this.pageSize) * this.pageSize + this.pageSize;
if (this.pageSize > this.totalPageCount || this.currentPage > this.totalPageCount || x > this.totalPageCount) {
return this.totalPageCount;
相关文档:
该控件可以实现在页面中弹出一个窗口,这个窗口不是一个新的浏览器窗口,而是镶嵌在页面中的一个层。
1 创建一个linkbutton,用于点击打开窗口。
2 拖入一个panel,这个就是我们要弹出的窗口。它也可以是两个嵌套的panel。例程上是这样做的,还是没有明白为什么这么做。
3 拖入一个ModalPopupExtender控件,在该控件的ta ......
Buffalo是国人开发的Ajax框架
它可以使用户在js中调用java代码里的方法.
配置方法:
1. web.xml中配置相关servlet 如下:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ......
function delDepart(){
if(confirm("要删除部门必须删除该部门与员工的关系以及其所有下属部门")){
var departId=form1.departId.value;//部门ID
var url = "Depart/DelDepart.aspx?DepartId="+departId;
......