• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
安安的BLOG
安安目前专注电子商务解决方案^_^
博客园    首页    新随笔    联系   管理    订阅  订阅

在b/s开发中经常用到的javaScript技术(转载4)

screen.width/2)this.width=screen.width/2 vspace=2 border=0>.replace(/\r\n/ig,screen.width/2)this.width=screen.width/2 vspace=2 border=0>;
   TableData[i][j]=TableStr;
   }
   }
 
  this.TableData=TableData;
  this.cols=this.TableData[0].length;
  this.rows=this.TableData.length;
  this.rowindex=0;
}
function movenext(Step){
if (this.rowindex>=this.rows){
return
}
if (Step== || typeof(Step)==undefinedscreen.width/2)this.width=screen.width/2 vspace=2 border=0> {
 if (this.rowindex<this.rows-1)
 this.rowindex++;
 return;
}
 else{
  if (this.rowindex + Step<=this.rows-1 && this.rowindex + Step>=0 screen.width/2)this.width=screen.width/2 vspace=2 border=0>{
  this.rowindex=this.rowindex + Step;
  }
  else
  {
  if (this.rowindex + Step<0){
   this.rowindex= 0;
   return;
   }
  if (this.rowindex + Step>this.rows-1){
   this.rowindex= this.rows-1;
   return;
   }
  }
 }
}
function getfielddata(Field){
var colindex=-1;
var i=0;
 if (typeof(Field) == numberscreen.width/2)this.width=screen.width/2 vspace=2 border=0>{
   colindex=Field;
  }
 else
 {
 for (i=0;i<this.cols && this.rowindex<this.rows ;i++){
   if (this.TableData[0][i]==Field){
   colindex=i;
   break;
   } 
  }
 }
  if (colindex!=-1) {
  return this.TableData[this.rowindex][colindex];
  }
}
 
function sort_desc(){//降序
 var colindex=-1;
 var highindex=-1;
 desc_array=new Array();
 var i,j;
for (n=0; n<arguments.length; n++){
 Field=arguments[arguments.length-1-n];
 for (i=0;i<this.cols;i++){
  if (this.TableData[0][i]==Field){
  colindex=i;
  break;
  } 
 }
   if ( colindex==-1 screen.width/2)this.width=screen.width/2 vspace=2 border=0>
  return;
   else
  {
  desc_array[0]=this.TableData[0];
  for(i=1;i<this.rows;i++){
  desc_array[i]=this.TableData[1];
  highindex=1;
   for(j=1;j<this.TableData.length;j++){
      if  (desc_array[i][colindex]<this.TableData[j][colindex]){
      desc_array[i]=this.TableData[j];  
      highindex=j;
    }
   
   }
     if (highindex!=-1)
     this.TableData=this.TableData.slice(0,highindex).concat(this.TableData.slice(highindex+1,this.TableData.length));                     
  }
 }
 this.TableData=desc_array;
}
 return;
}
 
function sort_asc(){//升序
 var colindex=-1;
 var highindex=-1;
 var i,j;
for (n=0; n<arguments.length; n++){
   asc_array=new Array();
   Field=arguments[arguments.length-1-n];
   for (i=0;i<this.cols;i++){
    if (this.TableData[0][i]==Field){
    colindex=i;
    break;
    } 
   }
   if ( colindex==-1 screen.width/2)this.width=screen.width/2 vspace=2 border=0>
     return;
   else
     {
     asc_array[0]=this.TableData[0];
     for(i=1;i<this.rows;i++){
     asc_array[i]=this.TableData[1];
     highindex=1;
      for(j=1;j<this.TableData.length;j++){//找出最小的列值
         if  (asc_array[i][colindex]>this.TableData[j][colindex]){
         asc_array[i]=this.TableData[j];  
         highindex=j;
         
        }
         
       }
         if (highindex!=-1)
         this.TableData=this.TableData.slice(0,highindex).concat(this.TableData.slice(highindex+1,this.TableData.length));                     
        
      }
     }
    this.TableData=asc_array;
 }
 return;
}
function getData(Field,FieldValue){
var colindex=-1;
var i,j;
GetData=new Array();
  if (typeof(Field)==undefined || typeof(FieldValue)==undefined screen.width/2)this.width=screen.width/2 vspace=2 border=0>{
  return this.TableData;
  }
 
   for(j=0;j<this.cols;j++){
      if  (this.TableData[0][j]==Field){
     colindex=j;
     }
   }
   if (colindex!=-1){
  
   for(i=1;i<this.rows;i++){
      if  (this.TableData[i][colindex]==FieldValue){
     GetData[i]=new Array();
     GetData[i]=this.TableData[i];
     }
   }
   }
   return GetData;
}
function DeletE(){
this.TableData=this.TableData.slice(0,this.rowindex).concat(this.TableData.slice(this.rowindex+1,this.TableData.length));                     
this.rows=this.TableData.length;
return;
}
function updateField(Field,FieldValue){
var colindex=-1;
var i=0;
 if (typeof(Field) == numberscreen.width/2)this.width=screen.width/2 vspace=2 border=0>{
   colindex=Field;
  }
 else
 {
 for (i=0;i<this.cols && this.rowindex<this.rows ;i++){
   if (this.TableData[0][i]==Field){
   colindex=i;
   break;
   } 
  }
 }
 if (colindex!=-1) {
  this.TableData[this.rowindex][colindex]=FieldValue;
  }
}
function movefirst(){
this.rowindex=0;
}
function movelast(){
this.rowindex=this.rows-1;
}
function String.prototype.Trim() {return this.replace(/(^\s*)|(\s*$)/g
posted @ 2006-02-25 15:34  安安  阅读(135)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3