?? dbgrid.js
字號:
var PreRowObj="";
var bDescending=false;
var iCellIndex;
var iRowIndex=0;
//滾動信息
function SynScroll()
{
HeaderSpan.scrollLeft = event.srcElement.scrollLeft;
}
//選中信息
function selectThis(theRowObj)
{
if (PreRowObj!="")
ListTable.rows(PreRowObj).className="";
theRowObj.className="selectColor";
PreRowObj=theRowObj.id;
return theRowObj;
}
//點擊鼠標右鍵
function ContextMenu()
{
}
function initScrollTable(oElement)
{
var oTable=document.getElementById("ListTable");
if (oTable==null)
return;
if (oTable.rows.length>0)
{
resizeScrollTable(oElement);
oElement.firstChild.syncTo = oElement.lastChild.uniqueID;
oElement.firstChild.syncDirection = "horizontal";
oElement.attachEvent("onresize", function () {
resizeScrollTable(oElement);
});
}
if (sortColumnName!="")
{
var oArrow = document.createElement("SPAN");
oArrow.className = "arrow";
var tn;
if (sortType==null || sortType=="")
return;
else if (sortType=="asc")
tn = document.createTextNode("5");
else
tn = document.createTextNode("6");
oArrow.appendChild(tn);
document.getElementById(sortColumnName).appendChild(oArrow);
}
}
function resizeScrollTable(oElement)
{
if (document.getElementById("NavArea")==null)
oElement.style.height=document.body.clientHeight;
else
oElement.style.height=document.body.clientHeight-36;
var head = oElement.firstChild.firstChild;
var headTable = head.firstChild;
var body = oElement.lastChild;
var bodyTable = body.firstChild.firstChild;
body.style.height = Math.max(0, oElement.clientHeight - head.offsetHeight);
var scrollBarWidth = body.offsetWidth - body.clientWidth;
// set width of the table in the head
headTable.style.width = Math.max(0, Math.max(bodyTable.offsetWidth + scrollBarWidth, oElement.clientWidth));
// go through each cell in the head and resize
var headCells = headTable.rows[0].cells;
var bodyCells = bodyTable.rows[0].cells;
for (var i = 0; i < bodyCells.length; i++)
{ /*
if (bodyCells[i].style.display=="none")
;//continue;
if (bodyCells[i].offsetWidth<headCells[i].offsetWidth)
bodyCells[i].style.width=headCells[i].offsetWidth-i+1;
else
headCells[i].style.width = bodyCells[i].offsetWidth;
*/
headCells[i].style.width = Math.max(headCells[i].offsetWidth,bodyCells[i].offsetWidth);
}
ResizeAll();
}
///////////////////////////////
//
//排序
//
//////////////////////////////
function sortByThis()
{
if (iCellIndex==null)
iCellIndex=event.srcElement.cellsIndex;
if (iCellIndex==event.srcElement.cellsIndex)
bDescending=!bDescending;
else
bDescending=false;
iCellIndex=event.srcElement.cellsIndex;
}
///////////////////////////////////////////
//
//排序結束
//
/////////////////////////////////////////////////
function changeRow()
{
/* var theRow;
if (event.keyCode==40) //下箭頭
{
if (PreRowObj==null || PreRowObj=="")
iRowIndex=0;
else
{
if (iRowIndex==ListTable.rows.length-1)
return false;
iRowIndex=ListTable.rows(PreRowObj).rowIndex+1;
}
}
if (event.keyCode==38) //上箭頭
{
if (PreRowObj==null || PreRowObj=="")
iRowIndex=0;
else
{
if (iRowIndex==0)
return false;
iRowIndex=ListTable.rows(PreRowObj).rowIndex-1;
}
}
theRow=ListTable.rows(iRowIndex);
selectThis(theRow);
*/
}
//document.onselectstart=function(){return false;};
document.onkeydown=changeRow;
//document.oncontextmenu=function(){return false;};
window.onresize=function()
{
var testElement = document.getElementById("ScrollArea");
if (testElement!=null)
initScrollTable(testElement);
}
window.attachEvent("onload", function () {
var testElement = document.getElementById("ScrollArea");
if (testElement!=null)
initScrollTable(testElement);
});
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -