📄 dtable.js
字号:
//fToggleTags(left,top,width,height);
function fToggleTags(left1,top1,width1,height1){
if(left1==null || top1==null || width1==null || height1==null)
{
return false;
}
var theleft=left1;
var thewidth=parseInt(replace(width1.toString(),'px',''));
theleft=(replace(theleft.toString(),'px','')).toString();
with (document.all.tags("SELECT")){
for (i=0; i<length; i++)
{
var obj=item(i);
var thistop=DT_getPosition(obj).top;
var thisleft=DT_getPosition(obj).left;
if(thisleft>theleft && thisleft<(theleft + thewidth) && obj.name.indexOf('se_')>-1)
{
item(i).style.visibility = "hidden";
//goSelectTag[goSelectTag.length] = item(i);
}
/*
if ((item(i).Victor!="Won")&&DT_fTagInBound(item(i)))
{
item(i).style.visibility = "hidden";
goSelectTag[goSelectTag.length] = item(i);
}
*/
}
}
}
function DT_fTagInBound(aTag){ with (VicPopCal.style){ var l = parseInt(left); var t = parseInt(top); var r = l+parseInt(width); var b = t+parseInt(height); var ptLT = DT_fGetXY(aTag); return !((ptLT.x>r)||(ptLT.x+aTag.offsetWidth<l)||(ptLT.y>b)||(ptLT.y+aTag.offsetHeight<t)); }}
function DT_fGetXY(aTag){
var oTmp = aTag;
var pt = new Point(0,0);
var divtop=0;
/*
if(document.getElementById('DTable_SettledTableTitle'))
{
divtop=DTable_SettledTableTitle.scrollTop;
}
*/
do {
pt.x += oTmp.offsetLeft;
pt.y += oTmp.offsetTop;
oTmp = oTmp.offsetParent; }
while(oTmp.tagName!="BODY");
return pt;}
var gMonths=new Array(" 一月"," 二月"," 三月"," 四月"," 五月"," 六月"," 七月"," 八月"," 九月"," 十月","十一月","十二月");
with (document)
{
write("<Div id='VicPopCal' onclick='event.cancelBubble=true' style='POSITION:absolute;visibility:hidden;border:0px ridge;width:10;z-index:999;FILTER: progid:DXImageTransform.Microsoft.Shadow(Color=#333333,Direction=120,strength=5)'>");
write("<table border='1' bgcolor='cccccc' cellspacing=\"1\" cellpadding=\"0\">");
write("<tr>");
write("<TD VALIGN='middle' align='center'><input type='button' name='PrevMonth' value='<' onClick='DT_fPrevMonth()'>");
write(" <SELECT name='tbSelYear' onChange='DT_fUpdateCal(tbSelYear.value, tbSelMonth.value)' Victor='Won'>");
for(i=parseInt(tmpmindt.getFullYear().toString());i<=parseInt(tmpmaxdt.getFullYear().toString());i++) write("<OPTION value='"+i+"'>"+i+"年</OPTION>");write("</SELECT>"); write(" <select name='tbSelMonth' onChange='DT_fUpdateCal(tbSelYear.value, tbSelMonth.value)' Victor='Won'>");
for (i=0; i<12; i++)write("<option value='"+(i+1)+"'>"+gMonths[i]+"</option>");write("</SELECT>");write(" <input type='button' name='PrevMonth' value='>' onclick='DT_fNextMonth()'>");write("</td>");write("</tr><tr>");write("<TD align='center'>");write("<DIV style='background-color:teal'><table width='100%' border='0' cellspacing=\"1\" cellpadding=\"0\">");DT_fDrawCal(giYear, giMonth, 12, 12);write("</table></DIV>");write("</td>");write("</tr><TR align='center'>");write("<td>");write (" <select name='Dtablehour' Victor='Won' >");
for(i=0;i<24;i++){write("<option value='" + i + "'>" + i + "</option>");}write("</select>");write("时 <select name='Dtableminute' Victor='Won'>");
for(i=0;i<60;i++){write("<option value='" + i + "'>" + i + "</option>");}write("</select>");write("分 <select name='Dtablesecond' Victor='Won'>");
for(i=0;i<60;i++){write("<option value='" + i + "'>" + i + "</option>");}
write("</select>");write(" 秒</td></tr><tr><td id='DT_ct_ShowTD' align='center' style='cursor:hand;font:bold 12 宋体;color:#990000' bgcolor=#EEEEEE> </td></tr><tr><TD align='center'>");
write("<span style='cursor:hand;font:bold 12 宋体' onclick='DT_fSetDate(giYear,giMonth,giDay,Dtablehour.value,Dtableminute.value,Dtablesecond.value)' onMouseOver=\"this.style.color=gcToggle;document.all.DT_ct_ShowTD.innerHTML='【" + giYear +"-" + giMonth + "-" + giDay + " ' + document.all.Dtablehour.value + ':' + document.all.Dtableminute.value + ':' + document.all.Dtablesecond.value + '】'\" onMouseOut='this.style.color=0'>今天:"+giYear+"年"+giMonth+"月"+giDay+"日</span> <span style='font-family: wingdings' title='关闭' onclick='DT_fHideCalendar();' style='cursor:hand;'>x</span>");
write("</td></tr>");write("</TABLE></Div>");
}
var DT_resize_CurState=false;
var DT_resize_CurDown=false;
var DT_resize_CurId;
var DT_resize_OldPlace,DT_resize_NewPlace;
var DT_resize_isre=false;
function DT_resize_MoveCol(MyColId) {var DT_the_td = DT_get_Element(event.srcElement,'td');
if(EnableAdjustCellWidth_init==false)
{return false;}
if( DT_resize_CurDown==false)
{
if((window.event.x + window.document.body.scrollLeft) > (DT_thisTable.offsetLeft + MyColId.offsetLeft + (MyColId.offsetWidth-3)))
{
DT_resize_CurState=true;
window.document.body.style.cursor="e-resize";
DT_resize_nowX=window.event.x + window.document.body.scrollLeft;
}
else
{
DT_resize_CurState=false ;
window.document.body.style.cursor="Default" ;
}
DT_resize_CurId=MyColId ;
}
}
function getLength(s){
var n=0;
for(var i=0;i<s.length;i++){
if(s.charCodeAt(i)<256){ n=n+1; } else{ n=n+2; }
}
return n;
}
function getNstring(sStr,nLen){
var nStrLen = sStr.length;
var nCountLen = 0;
var nCharLen = 0;
var sCutStr = '';
for (var nTempCount = 0; nTempCount < nStrLen; nTempCount++){
nCharLen = Math.abs(sStr.charCodeAt(nTempCount));
nCountLen = (nCharLen > 255) ? nCountLen += 2 : nCountLen += 1;
if (nCountLen > nLen){
sCutStr = sStr.substring(0,nTempCount-2) + "..";
break;
}
else
{
sCutStr = sStr;
}
}
return sCutStr.replace(/\n/,",");
}
function getCellWidth(cellIndex,type)
{
var tmpwidth=0;
for(var i=DTable_minrowIndex-1;i<DT_Main_Tab.rows.length;i++){
var tmpstr;
if(type=='now')
{
tmpstr=DT_Main_Tab.rows[i].cells[cellIndex].innerHTML;
}
else if(type=='old')
{
tmpstr=DT_TableText[i][cellIndex].toString();
}
else
{
tmpstr=DT_TableText[i][cellIndex].toString();
}
var tmpNL=getLength(tmpstr);
if(tmpNL>tmpwidth)
{
tmpwidth=tmpNL
}
}
return tmpwidth ;
}
function DT_setCellText(cellIndex,N)
{
for(var i=DTable_minrowIndex-1;i<DT_Main_Tab.rows.length;i++){
var tmpstr=DT_TableText[i][cellIndex].toString();
if(tmpstr=='')
{
return false;
}
var tmpNL=getNstring(tmpstr,N);
DT_Main_Tab.rows[i].cells[cellIndex].innerText=tmpNL;
}
}
function UpBody()
{
var tmpcx=window.event.x + window.document.body.scrollLeft;
if( DT_resize_CurState==true )
{
var cellindex=replace(DT_resize_CurId.id.toString(),'DTableTitle','');
var maxLength;
if(DT_resize_nowX>(tmpcx-3) && DT_resize_nowX<(tmpcx+3))
{
maxLength=getCellWidth(cellindex,'old');
DT_resize_CurId.width =maxLength * (DT_fontSize/2) + 1 ;
//+ 5 + DT_Main_Tab.cellPadding
DT_thisTable.width=DT_thisTable.offsetWidth + (DT_resize_CurId.offsetWidth-DT_resize_oldcellwidth) ;
DT_resize_CurId.innertext=DT_resize_CurId.width ;
DT_setCellText(cellindex,maxLength);
}
else
{
maxLength=getCellWidth(cellindex,'now');
DT_resize_OldPlace=window.event.x + window.document.body.scrollLeft ;
DT_resize_oldcellwidth=DT_resize_CurId.offsetWidth;
DT_resize_oldtablewidth=DT_thisTable.offsetWidth;
}
DT_resize_CurState=false ;
DT_resize_CurDown=false ;
window.document.body.style.cursor="Default" ;
}
DT_sort_col=null;
}
function DT_resize_DownBody()
{
if (DT_resize_CurState==true)
{
DT_resize_CurDown=true ;
DT_resize_isre=true;
DT_resize_OldPlace=window.event.x + window.document.body.scrollLeft ;
DT_resize_oldcellwidth=DT_resize_CurId.offsetWidth;
DT_resize_oldtablewidth=DT_thisTable.offsetWidth;
}
}
function DT_resize_MoveBody()
{
if( DT_resize_CurDown==true )
{
var cellindex=replace(DT_resize_CurId.id.toString(),'DTableTitle','');
var maxLength=getCellWidth(cellindex,'now') - DT_Main_Tab.cellPadding;
window.document.body.style.cursor="e-resize" ;
DT_resize_NewPlace=window.event.x + window.document.body.scrollLeft ;
var tmpcidw=window.event.x - DT_resize_CurId.offsetLeft;
if(tmpcidw>4)
{
var strN=parseInt(tmpcidw/(DT_fontSize/2)-1);
DT_setCellText(cellindex,strN);
DT_resize_CurId.width =tmpcidw ;
DT_resize_CurId.innertext=DT_resize_CurId.offsetWidth ;
DT_thisTable.width=DT_resize_oldtablewidth + (( DT_resize_NewPlace - DT_resize_OldPlace));
DT_sort_col=null;
}
else
{
return false;
}
}
}
function SelectBody()
{
if (DT_resize_CurDown==true)
{
window.event.returnValue=false ;
}
}
function document.onmousedown()
{
DT_resize_DownBody();
}
function document.onselectstart()
{
SelectBody();
}
var DT_Main_Tab = null;
var DT_cur_row = null;
var DT_cur_col = null;
var DT_cur_cell = null;
var DT_Org_con = '';
var DT_sort_col = null;
var DT_show_col = false;
var DT_charMode = true;
var DT_act_fc = '';
var DT_cur_bgc = '#ccffcc';
var DT_cur_fc = '';
function DT_Listfun_initValue(firstrow)
{
if(parseInt(firstrow)==DTable_minrowIndex-1)
{
DT_TableText =new Array(DT_Main_Tab.rows.length);
}
try
{
for(i=firstrow;i<DT_Main_Tab.rows.length;i++)
{
if(parseInt(firstrow)==DTable_minrowIndex-1)
{
DT_TableText[i]=new Array(DT_Main_Tab.rows.length);
}
for(ii=0;ii<DT_Main_Tab.rows[DT_Main_Tab.rows.length-1].cells.length;ii++)
{
var strsev=new String();
var ishavecellvalue=true;
try
{
strsev=DT_Main_Tab.rows[i].cells[ii].cellText.toString();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -