posted 21 years ago
Hi,
I am using table.moveRow() function in IE to move the row contents up on click of a button, for NS and NS6 am assigning the innerHTML to the previous row and the previous row innerhtml to the present Row.
Thesee things are working fine for Windows NT and 2k IE and NS, IMAC NS
but this code is not working in IMAC IE Cud anybody please help me how to go about it?
My javascript goes like this
var BrowserType;
var rowCounter = 0;var row_count=0;
function checkbrowser()
{
var agt=navigator.userAgent.toLowerCase();
this.major = parseInt(navigator.appVersion);
this.minor = parseFloat(navigator.appVersion);
this.nav = ((agt.indexOf('mozilla')!=-1) && ((agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1)));
if (this.nav)
{
BrowserType='NS';
}
this.ie = (agt.indexOf("msie") != -1);
if (this.ie)
{
BrowserType='IE';
}
if (agt.indexOf("netscape6")!=-1)
{
BrowserType='NS6';
}
return BrowserType;
}
var checkb;
function moveUp(trPrev, trPresent)
{
otable = document.getElementById('personalizeTab');
var n=0;
var sel_row;
checkb = checkbrowser();
alert(checkb);
if(checkb == "IE")
{
for(i=0;i<otable.rows.length;i++)
{
if(otable.rows(i).id==trPresent)
{
n=i;
}
}
alert('n:'+n);
if(n>0)
{
//otable.moveRow(n,n-1);
}
}
else
{
for(i=0;i<otable.rows.length;i++)
{
if(otable.childNodes[1].childNodes[i].id==row_id)
{
n=i;
sel_row=otable.childNodes[1].childNodes[i];
}
}
if(n>0)
{
if(checkb=="NS")
{
prev_sib=sel_row.previousSibling;
parent_node=sel_row.parentNode;
if(prev_sib!=null)
{
parent_node.insertBefore(sel_row,prev_sib);
}
}
else
{
var lb_prevLink = document.getElementById(trPrev).innerHTML;
document.getElementById(trPrev).innerHTML = document.getElementById(trPresent).innerHTML;
document.getElementById(trPresent).innerHTML = lb_prevLink;
}
}}
}
here the arguments for function moveUp is trPrev (prevoius row id) and trPresent (present row id)
Please help
regards,
sowmya