i have a Javascript function as shown:
Expand|Select|Wrap|Line Numbers
- function move_row(tr_id,position){
- var parentTable = document.getElementById("TABLE");
- var table_length = parentTable.rows.length;
- if(parentTable.nodeName != 'TBODY')
- parentTable = parentTable.getElementsByTagName('TBODY')[0];
- if(parentTable.nodeName != 'TBODY')
- return false;
- if(position=='up'){
- var x = document.getElementById(1);
- var y = document.getElementById(0);
- if(x && y){
- parentTable.insertBefore(x, y);
- }
- }
- else{
- var x = document.getElementById(1);
- var y = document.getElementById(2);
- if(x && y){
- parentTable.insertBefore(y, x);
- }
- }
- }
this is a function to swap 2 rows of a table. The problem is that after 2 swapping a JS exception is occuring saying that "invalid Argument". (ie the argument passed to the insertBefore). Can anyone help me??????
This bug is only with IE(tested on IE7). Firefox has no bugs on this case...