index.debug.0.5.js.svn-base
资源名称:cindyblog.rar [点击查看]
上传用户:cdpainuo
上传日期:2022-07-12
资源大小:5257k
文件大小:4k
源码类别:
Jsp/Servlet
开发平台:
Java
- var Index = {
- nowPage:0,
- allPage:0,
- conf:{},
- parame:"",
- type:"All",
- callback:null,
- showList:function(conf,page,type){
- this.nowPage=0;
- this.type = "All";
- this.allPage = 0;
- if(conf){
- this.conf = conf;
- }
- if(page){
- this.nowPage = page;
- }
- if(type){
- this.type = type;
- }
- this.parame = "&type="+this.type+"&nowPage="+this.nowPage;
- this.doShow(this.conf);
- },
- next:function(){
- this.nowPage = this.nowPage + 1;
- if(this.nowPage > this.allPage-1){
- this.nowPage = this.nowPage - 1;
- alert("已经是最后一页了!");
- }else{
- this.parame = "&type="+this.type+"&nowPage="+this.nowPage;
- this.doShow(this.conf);
- }
- },
- before:function(){
- this.nowPage = this.nowPage - 1;
- if(this.nowPage < 0){
- this.nowPage = 0;
- alert("已经是第一页了!");
- }else{
- this.parame = "&type="+this.type+"&nowPage="+this.nowPage;
- this.doShow(this.conf);
- }
- },
- doShow:function(conf){
- if(!conf.only){
- Index.hideNodes();
- }
- Index.showNodes([conf]);
- if(conf.extend){
- Index.showNodes(conf.extend);
- }
- if(conf.url){
- Ajax.request('get',conf.url+this.parame,function(msg){
- eval(msg);
- if(elements.page){
- Index.allPage = elements.page.allPage;
- }
- if(conf.templete){
- var html = Index.doTemplete(conf.templete,elements.nodes[conf.id]);
- if(conf.page){
- html = html + Index.doTemplete(conf.page,[elements.page]);
- }
- document.getElementById("el_"+conf.id).innerHTML = html;
- var dothis = conf.id+".callback=elements.nodes[conf.id];";
- eval(dothis);
- }
- if(jssc){
- jssc.init();
- }
- });
- }
- },
- initIndex:function(){
- this.hideNodes();
- this.showNodes(indexList);
- Ajax.request('get','blog?m=getIndex',function(msg){
- eval(msg);
- for(var count in indexList){
- var el = indexList[count];
- if(el.templete){
- var html = Index.doTemplete(el.templete,elements.nodes[el.id]);
- document.getElementById("el_"+el.id).innerHTML = html;
- var dothis = el.id+".callback=elements.nodes[el.id];";
- eval(dothis);
- }
- }
- if(jssc){
- jssc.init();
- }
- });
- },
- doTemplete:function(t,n){
- var html = "";
- for(var i in n){
- html=html+t;
- var k = n[i];
- for(var temp in k){
- var desp = k[temp];
- html = html.replace(new RegExp("{"+temp+"}","g"),desp);
- }
- }
- return html;
- },
- doFollow:function(f,n){
- var html = "";
- for(var temp in n){
- var desp = k[temp];
- html = html.replace(new RegExp("{"+temp+"}","g"),desp);
- }
- return html;
- },
- hideNodes:function(){
- var l = allList;
- for(var count in l){
- if(count != "extend"){
- if(!l[count].always){
- var n = document.getElementById(l[count].id);
- var n2 = document.getElementById("el_"+l[count].id);
- if(!l[count].noChange){
- n2.innerHTML = "<li><img src="images/loading.gif"/></li>";
- }
- n.style.display = "none";
- }
- }
- }
- },
- showNodes:function(config){
- for(var c in config){
- if(c != "extend"){
- document.getElementById(config[c].id).style.display = "block";
- }
- }
- }
- };
- var checkform = function(form){
- rtoStore();
- var m =Validator.Validate(form,3);
- if(m){
- var children = form.elements;
- for(var i =0;i<children.length;i++){
- if(children[i].tagName != 'BUTTON' && children[i].tagName != 'button'){
- if(children[i].type !='BUTTON' && children[i].type != 'button' && children[i].name != ''){
- if((children[i].value).substring(0,11) == 'javascript:'){
- var value = children[i].value;
- var v = value.replace(new RegExp("javascript:","g"),"");
- v = eval(value);
- children[i].value = v;
- }
- }
- }
- }
- }
- return m;
- }