flash和asp分页的一点心得与flash脚本(2)
list["lbn"+i]._visible = true;
list["ltitle"+i].text = Ftitle(temp.firstChild.nodeValue, 22);
list["lauthor"+i] = temp.attributes.author;
list["ltime"+i] = temp.attributes.Addtime;
}
pageInfo.text = logname+"共有日志"+Tnum+"篇 共"+Tpage+"页 当前是第"+page+"页 "+"15/页";
bn_u.enabled = true;
bn_d.enabled = true;
} else {
pageInfo.text = "当前没有日志。";
list.ltitle1.text = "读取数据出错,请联系管理员!";
}
}
//一个自定义的格式标题的函数,怕标题太长
function Ftitle(s, n) {
if (length(s)>n) {
s = s.substring(0, n-1)+"...";
}
return s;
}
logList.onLoad = logFunc;
//-------------------------------------
//按钮动作
Bn_up = new Object();
//按钮事件,判断页面大小是否超过值
Bn_up.click = function(evt) {
if (page>1) {
_root.page--;
gotoAndPlay("cycle");
} else {
stop();
}
};
Bn_d = new Object();
Bn_d.click = function(evt) {
if (page<Tpage) {
_root.page++;
gotoAndPlay("cycle");
} else {
stop();
}
};
bn_u.addEventListener("click", Bn_up);
bn_d.addEventListener("click", Bn_d);
桢"cycle"只有一个话:
gotoAndPlay("list");
//形成一个简单的循环
Tree_list.asp:
//log 是我的日志表 ,log_cat是分类表
下面的asp很清楚了
<?xml version="1.0" encoding="gb2312"?>
<%
Response.ContentType = "text/xml"
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = 0
dim log_cat,page,pageSize,Tnum,Tpage,log_name
page=TreeRequest("page",1)
log_cat=TreeRequest("log_cat",1)
pageSize=15
call Tree_rs
if log_cat=0 or log_cat="" then
sql="select * from log order by written_time DESC,log_ID DESC"
else
sql="select * from log,log_cat where log.cat_id=log_cat.ID and cat_id="&log_cat&" order by written_time DESC,log_ID DESC"
End if
rs.open sql,conn,1,1
rs.PageSize=pageSize
Tnum=rs.RecordCount
Tpage=Int(Tnum/pageSize*-1)*-1
if page="" then page=1
内容版权声明:除非注明,否则皆为本站原创文章。