web文件管理器的后续开发(3)
case "Attributes":
return f1.Attributes>f2.Attributes? true:false;
default:
return false;
}
}
this.sort=function(field, order)
{
//order:desc asc
//field:Name Size
var len = this.root.length;
if( len < 2 ) return;
var tmp;
for(var i=0; i<len-1; i++)
{
for(var j=i+1; j<len; j++)
{
if( order == "desc")
{
if( !this.max( this.root[i], this.root[j], field ) )
{
tmp = this.root[i];
this.root[i] = this.root[j];
this.root[j] = tmp;
}
}
else if ( order == "asc")
{
if( this.max( this.root[i], this.root[j], field ) )
{
tmp = this.root[i];
this.root[i] = this.root[j];
this.root[j] = tmp;
}
}
}
}
}
}
function fieldcode(field)
{
if (order == 'desc')
{
order = 'asc';
}
else
{
order = 'desc';
}
tree.sort(field, order);
}
function show()
{
//for (var i=0;i<form1.elements.length;i++){var e = form1.elements[i];if (e.type == "checkbox")e.checked = form1.chkall.checked;}
str = '<table width="100%" border="0" cellspacing="0" cellpadding="0">\
<tr bgcolor="#EEEEEE">\
<td><div align="center">操作<input type="checkbox" name="chkall" onclick=""></div></td>\
<td><div align="center"><a onclick="fieldcode(\'Name\');show();" href=#>文件名</a></div></td>\
<td><div align="center"><a onclick="fieldcode(\'Size\');show();" href=#>大小</a></div></td>\
<td><div align="center"><a onclick="fieldcode(\'Type\');show();" href=#>类型</a></div></td>\
内容版权声明:除非注明,否则皆为本站原创文章。