欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

flash和asp分頁的一點(diǎn)心得與flash腳本

 更新時(shí)間:2007年03月02日 00:00:00   作者:  
看了這個(gè)的一些帖子,學(xué)到了很多東西,現(xiàn)在和大家一起分享 
  flash現(xiàn)在只是一個(gè)顯示的功能,過程中看了一些別人的東西,覺得分頁似乎有很簡單的實(shí)現(xiàn)方式.基本上都是用xml傳送的.顯示用 list 組件和 datagrid 都可以,這里我用的是動(dòng)態(tài)文本,因?yàn)橛X得組件用的太麻煩了.所以用了蠢辦法,沒辦法,找不到更好的~~~下面代碼中的 list[..]就是動(dòng)態(tài)文本的名趁,一次顯示15條

//顯示程序如下: 

//楨名稱 "list" 
stop(); 
var logList = new XML(); 
var logroot; 
var page:Number; //當(dāng)前頁 
var Tpage:Number; //保存總頁 
var Tnum:Number; //總?cè)罩緮?shù) 
var logname:String; //日志分類名稱 
var temp; 
var i:Number; 

//這里我用一個(gè)數(shù)組儲(chǔ)存了對(duì)應(yīng)的id號(hào),如果用組件就不用這么麻煩了 
var ids = new Array(15); 

//兩個(gè)按鈕,用來翻頁 
bn_u.enabled = false; 
bn_d.enabled = false; 
if (page == null or page<1) { 
page = 1; 

//------------------------------ 
//清除函數(shù); 
function myclear() { 
for (i=1; i<16; i++) { 
ids[i-1] = 0; 
list["lbn"+i]._visible = false; 
list["ltitle"+i].text = ""; 
list["lauthor"+i] = ""; 
list["ltime"+i] = ""; 


//-------------------------------------- 
//-------------------------------------- 
myclear(); 
pageInfo.text = "正在讀取數(shù)據(jù)..."; 
logList.ignoreWhite = true; 
logList.load("Tree_list.asp?log_cat="+cat_id+"&page="+page); 
//------------------------------------------------ 
//get數(shù)據(jù)函數(shù) 
function logFunc(e) { 
if (e) { 
logroot = logList.firstChild; 
logname = logroot.attributes.logname; 
Tpage = logroot.attributes.Tpage; 
Tnum = logroot.attributes.Tnum; 
temp = logroot.firstChild; 
list.ltitle1.text = Ftitle(temp.firstChild.nodeValue, 22); 
list.lauthor1 = temp.attributes.author; 
list.ltime1 = temp.attributes.Addtime; 
ids[0] = temp.attributes.id; 
i = 1; 
list.lbn1._visible = true; 
//循環(huán)讀取節(jié)點(diǎn) 
while (temp.nextSibling != null) { 
temp = temp.nextSibling; 
i++; 
//如果是用別的方式顯示,只需要改一下就可以了 
ids[i-1] = temp.attributes.id; 
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+"頁 當(dāng)前是第"+page+"頁 "+"15/頁"; 
bn_u.enabled = true; 
bn_d.enabled = true; 
} else { 
pageInfo.text = "當(dāng)前沒有日志。"; 
list.ltitle1.text = "讀取數(shù)據(jù)出錯(cuò),請(qǐng)聯(lián)系管理員!"; 



//一個(gè)自定義的格式標(biāo)題的函數(shù),怕標(biāo)題太長 
function Ftitle(s, n) { 
if (length(s)>n) { 
s = s.substring(0, n-1)+"..."; 

return s; 

logList.onLoad = logFunc; 
//------------------------------------- 
//按鈕動(dòng)作 
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"只有一個(gè)話: 
gotoAndPlay("list"); 
//形成一個(gè)簡單的循環(huán) 

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 
if Tnum<>0 then rs.AbsolutePage=page 
if log_cat=0 or log_cat="" then 
log_name="[全部分類]" 
else 
log_name="["&rs("cat_name")&"]" 
End if 
'以下輸出xml 
'------------------------------------------------ 
response.write("<Tree logname='"&log_name&"' Tnum='"&Tnum&"' Tpage='"&Tpage&"'>") 
if rs.eof then 
rs.close 
else 
do while not rs.eof and pageSize>0 
response.write("<Trees author='"&rs("log_author")&"' Addtime='"&rs("written_time")&"' id='"&rs("log_ID")&"'>") 
response.write("<![CDATA["&rs("log_tittle")&"]]></Trees>") 
pageSize=pageSize-1 
rs.movenext 
loop 
rs.close 
End if 
//關(guān)閉rs 
call Tree_rsclose 
call Tree_conclose 
response.write("</Tree>") 
%>

相關(guān)文章

最新評(píng)論