客户端实现类似于DataGrid的输入表格控件[5]

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 curllion 的 blog

br/>       this.textboxs[k].value = tmp.substr(0,tmp.length-1);
       k++;
    }
}
//删除指定位置的行,如果删除过快,就ie就会死掉,所以放用户确认一下,并且再重绘时,先清掉,防止宕掉
clientdatagrid.prototype.deleterowat = function(index)
{
    if(confirm("确认要删除吧?"))
    {
        this.parent.innerhtml = "";
     this.selectedindex = -1;
  if(index < 0 || index >= this.rowcount)
  {
         window.alert("指定的位置没有行");
      return;
  }
  tmprows   = this.rows.slice(0,index).concat(this.rows.slice(index+1,this.rowcount));
  this.rows = tmprows;
  this.rowcount--;
  //eval("window.document.all(\"" + this.id + "_datagrid\").deleterow(" + index + ");")
     this.draw(this.id);
    }
}

//-----------------------------------行对象------------------------------
function datarow(data)
{
    this.itemcount  = data.length;        //一行的元素个数
    this.data       = new array();      //记录数据
    for(var i = 0 ;i<this.itemcount ;i++)
    {
        this.data[i] = data[i];
    }
}
</script>

 

如何使用,例如

   <script language="javascript">
var textboxs = new array(document.form1.pfy ,document.form1.presult);
var colwidths = new array("80px","180px",null);
var dg = new clientdatagrid(3,new array("代码","费用类型","金额"),25,25,colwidths,new array(1,0,1),new array(0,0,1),textboxs,document.all("fylist"));
dg.width  = 455;
dg.css = "background-color:white;border-color:#cc9966;border-width:1px;border-style:none;border-collapse:collapse;";
dg.titlecss = "color:#ffffcc;background-color:#990000;font-weight:bold;";
dg.bordercolor = "#cc9966";
dg.selectedcss = "color:#663399;background-color:#ffcc66;";
dg.draw("dg");

本文关键:客户端实现类似于DataGrid的输入表格控件
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top