//ajax 控件 function pageajax(){ var xhrobj=null; if(window.xmlhttprequest) { xhrobj=new xmlhttprequest(); } else if(window.activexobject) { try{ xhrobj=new activexobject("microsoft.xmlhttp"); } catch(e1) { try{ xhrobj=new activexobject("msxml2.xmlhttp"); } catch(e2){ try{ xhrobj=new activexobject("msxml3.xmlhttp"); } catch(e3){ alert("创建ajax失败:"+e3) } } } } else { alert("未能识别的浏览器"); } return xhrobj; } function page(curpage,labelid,classid,installdir,url,refreshtype,specialid) { this.labelid=labelid; this.classid=classid; this.url=url; if (labelid.substring(0,5)=="{sql_") { var slabelid=labelid.split('(')[0]; slabelid=slabelid.replace("{",""); this.c_obj="c_"+slabelid; this.p_obj="p_"+slabelid; } else { this.c_obj="c_"+labelid; this.p_obj="p_"+labelid; } this.installdir=installdir; this.refreshtype=refreshtype; this.specialid=specialid; this.page=curpage; loaddata(1); } function loaddata(p) { this.page=p; var xhr=new pageajax(); xhr.open("get",installdir+url+"?labelid="+escape(labelid)+"&classid="+classid+"&refreshtype="+refreshtype+"&specialid=" +specialid+"&curpage="+p+geturlparam(),true); xhr.onreadystatechange=function (){ if(xhr.readystate==1) { if (p==1) eval('document.all.'+c_obj).innerhtml="
正在连接服务器...
"; } else if(xhr.readystate==2 || xhr.readystate==3) { if (p==1) eval('document.all.'+c_obj).innerhtml="
正在读取数据...
"; } else if(xhr.readystate==4) { if (xhr.status==200) { var pagearr=xhr.responsetext.split("{ks:page}") var pageparamarr=pagearr[1].split("|"); count=pageparamarr[0]; perpagenum=pageparamarr[1]; pagecount=pageparamarr[2]; itemunit=pageparamarr[3]; itemname=pageparamarr[4]; pagestyle=pageparamarr[5]; getobject(c_obj).innerhtml=pagearr[0]; pagelist(); } } } xhr.send(null); } //取url传的参数 function geturlparam() { var urlparams = new object() ; var aparams = document.location.search.substr(1).split('&') ;//substr(n,m)截取字符从n到m,split('o')以o为标记,分割字符串为数组 var sum=new array(aparams.length);//定义数组 for (i=0 ; i < aparams.length ; i++) { sum[i]=new array(); var aparam = aparams[i].split('=') ;//以等号分割 urlparams[aparam[0]] = aparam[1] ; sum[i][0]=aparam[0]; sum[i][1]=aparam[1]; } var p=''; for(i=0;i首页 上一页 下一页 尾页 页次:"+this.page+"/"+this.pagecount+"页 "+this.perpagenum+this.itemunit+this.itemname+"/页"; break; case 2: statushtml=""+this.pagecount+"页/"+this.count+this.itemunit+" 9 7 "; var startpage=1; if (this.page==10) startpage=2; else if(this.page>10) startpage=eval((parseint(this.page/10)-1)*10+parseint((this.page)%10)+2); for(var i=startpage;i<=this.pagecount;i++){ if (i==this.page) statushtml+=""+i+" " else statushtml+=""+i+" " n=n+1; if (n>10) break; } statushtml+="8 :"; statushtml=""+statushtml+""; break; case 4: statushtml="共"+this.pagecount+"页/"+this.count+this.itemunit+this.itemname+" 9 7 "; for(var i=this.page;i<=this.pagecount;i++){ if (i==this.page) statushtml+=""+i+" " else statushtml+="["+i+"] " n=n+1; if (n>10) break; } statushtml+="8 :"; break; case 3: statushtml="第"+this.page+"页 共"+this.pagecount+"页 << < > >> "+this.perpagenum+this.itemunit+this.itemname+"/页"; break; } statushtml+=" 第页"; getobject(this.p_obj).innerhtml=statushtml; } function homepage() { if(this.page==1) alert("已经是首页了!") else loaddata(1); } function lastpage() { if(this.page==this.pagecount) alert("已经是最后一页了!") else loaddata(this.pagecount); } function previouspage() { if (this.page>1) loaddata(this.page-1); else alert("已经是第一页了"); } function nextpage() { if(this.page