⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dtable.js

📁 利用ASP.NET技术完成个人网站的设计
💻 JS
📖 第 1 页 / 共 5 页
字号:
}
catch(e)
{
ishavecellvalue=false;
}

if(ishavecellvalue==false)
{
if(i==0)
{
	
strsev=DT_Main_Tab.rows[i].cells[ii].innerHTML.toString();
	


}
else
{
strsev=DT_Main_Tab.rows[i].cells[ii].innerText.toString();

}
}
strsev=Trim(strsev);
DT_Main_Tab.rows[i].cells[ii].cellText=strsev;
DT_TableText[i][ii]=strsev;

}//end for ii
}//end for i
	}//end try
	catch(e)
	{}

DT_arrowUp = document.createElement('SPAN'); 
DT_arrowUp.innerHTML = '5'; 
DT_arrowDown = document.createElement('SPAN');
DT_arrowDown.innerHTML = '6';
DT_arrowUp.style.cssText =DT_SortUpText;
DT_arrowDown.style.cssText =DT_SortDownText;
}



function DT_Listfun_init()
{
DT_cur_row = null; DT_cur_col = null;
DT_cur_cell = null; 
DT_sort_col = null; 
DT_Main_Tab = DT_thisTable;
DT_read_def(DT_Main_Tab);
DT_Main_Tab.onclick = DT_Listfun_clickIt;

DT_fontSize=DT_Main_Tab.style.fontSize;
if(DT_fontSize.length<1)
{
DT_fontSize=9;
}
DT_Org_con = DT_Main_Tab.outerHTML;
DT_arrowUp = document.createElement('SPAN'); 
DT_arrowUp.innerHTML = '5'; 
DT_arrowDown = document.createElement('SPAN');
DT_arrowDown.innerHTML = '6';
DT_arrowUp.style.cssText =DT_SortUpText;
DT_arrowDown.style.cssText =DT_SortDownText;

EnableDragCell_init=EnableDragCell;
EnableSort_init=EnableSort;
EnableAdjustCellWidth_init=EnableAdjustCellWidth;



DT_Listfun_initValue(DTable_minrowIndex-1);
for(i=0;i<DT_Main_Tab.rows.length;i++)
{
try
{
for(ii=0;ii<DT_Main_Tab.rows[DTable_minrowIndex-1].cells.length;ii++)
{
if(i==(DTable_minrowIndex-1) && ii>0)
{
DT_Main_Tab.rows[i].cells[ii].id='DTableTitle' + ii;
DT_Main_Tab.rows[i].cells[ii].onmousemove=function (){DT_resize_MoveCol(this)};


}


if(DT_Main_Tab.rows[i].cells[ii]!=null)
{
DT_Main_Tab.rows[i].cells[ii].className='DT_List_CellStyle';
}
}
}
catch(e)
{
alert(e+ 'i:' + i + ' ii:' + ii);
}
}
}



function document.onclick(){


if(document.getElementById('VicPopCal'))
	{
	DT_fHideCalendar();
	}



var obj = event.srcElement;

if(document.getElementById('dtablejsqc'))
	{
	
	while(obj!=null && typeof(obj.tagName) != 'undefind')
		{
	
	if(obj.id=='dtablejsqc')return;
    obj = obj.parentElement;
         }
		 DT_hidejsq();
    // dtablejsqc.style.visibility='hidden';

    }

try
	{
DT_Listfun_clearcolor(); 
DT_cur_row = null;
DT_cur_col = null;
DT_cur_cell = null; 
	}
catch(e)
		{}
}

function DT_read_def(DT_DT_the_table){

for(var i=0;i<DT_DT_the_table.rows.length;i++){
for(var j=0;j<DT_DT_the_table.rows[i].cells.length;j++)
{
with(DT_DT_the_table.rows[i])
{
cells[j].oBgc = '';
cells[j].oFc ='';


if(i==DTable_minrowIndex-1 ){
cells[j].onmousedown = DT_Listfun_dragstart;
cells[j].onmouseup = DT_Listfun_dragend;
}
}
}
}
}

function DT_get_Element(DT_the_ele,DT_the_tag){
DT_the_tag = DT_the_tag.toLowerCase(); 
if(DT_the_ele.tagName.toLowerCase()==DT_the_tag)
{return DT_the_ele;}

while(DT_the_ele=DT_the_ele.offsetParent)
{ 
if(DT_the_ele.tagName.toLowerCase()==DT_the_tag){return DT_the_ele;}}

return(null);
}
var DT_dragStart= false;
var DT_dragColStart = null;
var DT_dragColEnd = null;


function DT_Listfun_dragstart(){
if(EnableDragCell_init==true)
{

if(DT_resize_CurState==false && DT_resize_CurDown==false)
{

 DT_resize_isre=false;
var DT_the_td = DT_get_Element(event.srcElement,'td');

if(DT_the_td==null)
{
return;
}
if(DT_the_td.cellIndex<1)
	{
return false;
	}


DT_dragStart = true;
DT_dragColStart = DT_the_td.cellIndex; 

DT_drag.style.width = DT_the_td.offsetWidth; 
DT_drag.style.height = DT_the_td.offsetHeight;

DT_drag.innerHTML = DT_the_td.innerHTML; 
DT_drag.style.backgroundColor = DT_the_td.oBgc;
DT_drag.style.color = DT_the_td.oFc;
function document.onmousemove(){

if(event.button==1)
{
if(DT_resize_CurState==false && DT_resize_isre==false && EnableDragCell_init==true)
{
DT_drag.style.display = '';
var thistop=DT_getPosition(DT_the_td).top

DT_drag.style.top = thistop ;
var thisx=window.event.screenX;

DT_drag.style.left = thisx-DT_drag.offsetWidth/2;
DT_drag.style.backgroundColor=DT_act_bgc;

for(var i=1;i<=DT_Main_Tab.rows[DTable_minrowIndex-1].cells.length-1;i++)
{
with(DT_Main_Tab.rows[DTable_minrowIndex-1].cells[i])
{

if((event.x>offsetLeft+parseInt(DT_getPosition(DT_thisTable).left) && event.x<offsetLeft+offsetWidth+ parseInt(DT_getPosition(DT_thisTable).left)))
{

runtimeStyle.backgroundColor=DT_act_bgc;
DT_dragColEnd=cellIndex;

}
else
{
runtimeStyle.backgroundColor=''; }
}// end if
}// end with


}//end for


}
DT_resize_MoveBody();
}//end EnableDragCell_init
}
}
else
{

}
}
function DT_Listfun_dragend(){
if(DT_resize_CurState==false && DT_resize_CurDown==false && DT_resize_isre==false && EnableDragCell_init==true)
{

//

DT_dragStart = false; 
DT_drag.style.display='none'; 
DT_drag.innerHTML = ''; 
DT_drag.style.width = 0;
DT_drag.style.height = 0;


for(var i=1;i<=DT_Main_Tab.rows[DTable_minrowIndex-1].cells.length-1;i++)
{
DT_Main_Tab.rows[DTable_minrowIndex-1].cells[i].runtimeStyle.backgroundColor=''; 
}
if(DT_dragColStart!=null && DT_dragColEnd!=null && DT_dragColStart!=DT_dragColEnd)
{

DT_Listfun_changecol(DT_Main_Tab,DT_dragColStart,DT_dragColEnd);

if(DT_dragColStart==DT_sort_col)
{
DT_sort_col=DT_dragColEnd;
}
else if(DT_dragColEnd==DT_sort_col)
{
DT_sort_col=DT_dragColStart; 
document.onclick();
}


}
if(DT_sort_col!=null)
{ 
with(DT_thisTable.rows[DTable_minrowIndex-1].cells[DT_sort_col])
{
removeChild(lastChild);
}
DT_sort_col=null;
}


DT_Listfun_initValue(DTable_minrowIndex-1);

DT_dragColStart = null;
DT_dragColEnd = null; 
document.onmousemove=null;

}
else if(DT_resize_CurState==true && DT_resize_CurDown==true && DT_resize_isre==true)
{

if(EnableDragCell_init==true)
{
DT_dragStart = false; 
DT_drag.style.display='none'; 
DT_drag.innerHTML = ''; 
DT_drag.style.width = 0;
DT_drag.style.height = 0;
for(var i=0;i<DT_Main_Tab.rows[DTable_minrowIndex-1].cells.length;i++)
{ DT_Main_Tab.rows[DTable_minrowIndex-1].cells[i].runtimeStyle.backgroundColor=''; }
if(DT_dragColStart!=null && DT_dragColEnd!=null && DT_dragColStart!=DT_dragColEnd) {
DT_Listfun_changecol(DT_Main_Tab,DT_dragColStart,DT_dragColEnd);
if(DT_dragColStart==DT_sort_col)
{
DT_sort_col=DT_dragColEnd;
}
else if(DT_dragColEnd==DT_sort_col){
DT_sort_col=DT_dragColStart; 
document.onclick();
}
}


}
DT_dragColStart = null;
DT_dragColEnd = null; 
document.onmousemove=null;
UpBody();

}

}

function DT_Listfun_clearcolor(){ 
DT_the_table=DT_Main_Tab;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -