您好,欢迎访问一九零五行业门户网

拖拉表格的JS函数_javascript技巧

js:
复制代码 代码如下:
/*
@parem object the tbody's object
@parem object tr's object (must be null)
@parem string the classname of onmousedown
@parem string the classname of onmouseout
*/
function order(tt,old,classover,classout) {
var sf = arguments.callee; //get the function self
var trs = tt.getelementsbytagname('tr');
for(var i=0;itrs[i].onmousedown = function () {
if(this.style.cursor == 'move') {
return false;
}
classout = this.classname;
this.classname = classover;
this.style.cursor = 'move';
old = this;
}
trs[i].onmouseover = function () {
if(this.style.cursor == 'move' || !old) {
return false;
}
var tmp_old = old.clonenode(true);
var tmp_now = this.clonenode(true);
var p = this.parentnode;
p.replacechild(tmp_now,old);
p.replacechild(tmp_old,this);
sf(tt,tmp_old,classover,classout);
}
trs[i].onmouseout = function () {
//this.classname = classout;
}
trs[i].onmouseup = function () {
this.classname = classout;
this.style.cursor = '';
old = null;
}
}
}
示例: 
复制代码 代码如下:
无标题文档
id
记录
1
记录
2
记录
3
记录
4
记录
其它类似信息

推荐信息