最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
客户端JS表格排序---摘自微软.
时间:2022-06-30 09:45:42 编辑:袖梨 来源:一聚教程网
/**
*表格排序
*t:表格体.例:myTable.tBodies[0]
*iRowEnd:第几行停止排序.例:myTable.tBodies[0].rows.length-1
*fReverse:升序,降序.例:true(升)false(降)
*iColumn:第几列需要排序.例 4
*/
function insertionSort(t, iRowEnd, fReverse, iColumn)
{
var iRowInsertRow, iRowWalkRow, current, insert;
for ( iRowInsert = 0 + 1 ; iRowInsert <= iRowEnd ; iRowInsert++ )
{
if (iColumn)
{
if( typeof(t.children[iRowInsert].children[iColumn]) != "undefined")
textRowInsert = t.children[iRowInsert].children[iColumn].innerText;
else
textRowInsert = "";
}
else
{
textRowInsert = t.children[iRowInsert].innerText;
}
for ( iRowWalk = 0; iRowWalk <= iRowInsert ; iRowWalk++ )
{
if (iColumn)
{
if(typeof(t.children[iRowWalk].children[iColumn]) != "undefined")
textRowCurrent = t.children[iRowWalk].children[iColumn].innerText;
else
textRowCurrent = "";
}
else
{
*表格排序
*t:表格体.例:myTable.tBodies[0]
*iRowEnd:第几行停止排序.例:myTable.tBodies[0].rows.length-1
*fReverse:升序,降序.例:true(升)false(降)
*iColumn:第几列需要排序.例 4
*/
function insertionSort(t, iRowEnd, fReverse, iColumn)
{
var iRowInsertRow, iRowWalkRow, current, insert;
for ( iRowInsert = 0 + 1 ; iRowInsert <= iRowEnd ; iRowInsert++ )
{
if (iColumn)
{
if( typeof(t.children[iRowInsert].children[iColumn]) != "undefined")
textRowInsert = t.children[iRowInsert].children[iColumn].innerText;
else
textRowInsert = "";
}
else
{
textRowInsert = t.children[iRowInsert].innerText;
}
for ( iRowWalk = 0; iRowWalk <= iRowInsert ; iRowWalk++ )
{
if (iColumn)
{
if(typeof(t.children[iRowWalk].children[iColumn]) != "undefined")
textRowCurrent = t.children[iRowWalk].children[iColumn].innerText;
else
textRowCurrent = "";
}
else
{
相关文章
- 王者荣耀侦探能力大测试攻略 王者荣耀侦探能力大测试怎么过 11-22
- 无期迷途主线前瞻兑换码是什么 11-22
- 原神欧洛伦怎么培养 11-22
- 炉石传说网易云音乐联动怎么玩 11-22
- 永劫无间手游确幸转盘怎么样 11-22
- 无期迷途主线前瞻兑换码是什么 无期迷途主线前瞻直播兑换码介绍 11-22