Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
if(typeof document.getElementsByTagName("TABLE")[0].moveRow == "undefined"){
Node.prototype.moveRow = function(){
if(this && this.nodeName.match(/^(table|t(body|head|foot))$/i)){
try {
one = (!arguments[0] && arguments[0] != 0?-1:arguments[0]);
two = (!arguments[1] && arguments[1] != 0?-1:arguments[1]);

// Makes sure the row exists and then makes sure the insertable row isn't greater then the length
if(!this.rows[one] || two > this.rows.length){
var err = new Error();
throw err;
}

// This is just so that it gets put in the right place.
if(two > one)
two = two+1;
else if(one > two)
one = one+1;

newRow = this.insertRow(two);
newRow.innerHTML = this.rows[one].innerHTML;
this.deleteRow(one);
} catch(e) {
}
}
}
}


:P

moveRow's an IE only function, so I got bored and made this. moveRow according to Microsoft.

I tihnk it mimics everything perfectly... find any bugs, let me know.


hpmad

hpmad Avatar



858


September 2005
Nice, I didn't even know there was a moveRow function.

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Yeah, I didn't either until I noticed on accident when looking up a function. :P

newBookmarkLockedFalling