Pull the table and call a function. JS:
The Code is as follows:
/*
@ 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; I Trs [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;
}
}
}
Example:
The Code is as follows:
Untitled document