?? selbut.js
字號:
var LeftNum=0,RightNum=0;
// 選中當前所選定的行
function selectThis()
{
var newRow,newCell,index;
index=parent.frames.item("FunctionList").document.all.item("FunctionList").selectedIndex;
addItem(index);
getRows();
enableButtons(LeftNum,RightNum);
}
//增加下拉框的項目
function addItem(index)
{
var optionLen,theIndex;
var newRow,newCell,SelList="";
SelList=" <select>\r"+
"<option value=\"1\" selected>瀏覽信息</option>\r"+
"<option value=\"2\">更新信息</option>\r"+
"<option value=\"3\" >刪除信息</option>\r"+
"</select>";
newRow=parent.frames.item("AddFunction").Tb.insertRow(); //增加一行
newRow.id=parent.frames.item("FunctionList").document.all.item("FunctionList").options(index).value;
newRow.className="Normal";
newCell=newRow.insertCell(); //增加權限名稱一列
newCell.noWrap=true;
newCell.align="left";
newCell.innerText=parent.frames.item("FunctionList").document.all.item("FunctionList").options(index).text;
newCell=newRow.insertCell();//增加具體權限下拉框
newCell.noWrap=true;
newCell.innerHTML=SelList;
parent.frames.item("FunctionList").document.all.item("FunctionList").remove(index);
}
//刪除當前所選定的行
function deleteThis()
{
var optionLen,theRowID;
theRowID=parent.frames.item("SelBut").document.all.item("RowID").value;
optionLen=parent.frames.item("FunctionList").document.all.item("FunctionList").length;
parent.frames.item("FunctionList").document.all.item("FunctionList").length=optionLen+1;
parent.frames.item("FunctionList").document.all.item("FunctionList").options(optionLen).value=theRowID;
parent.frames.item("FunctionList").document.all.item("FunctionList").options(optionLen).text=parent.frames.item("AddFunction").document.all.item("Tb").rows(theRowID).cells(0).innerText;
parent.frames("AddFunction").document.all.item("Tb").deleteRow(parent.frames.item("AddFunction").document.all.item("Tb").rows(theRowID).rowIndex);
parent.frames("AddFunction").PreiorSel="";
parent.frames("AddFunction").isDel=true;
getRows();
enableButtons(LeftNum,RightNum);
}
//選中所有的行
function selectAll()
{
for (index=parent.frames.item("FunctionList").document.all.item("FunctionList").length-1;index>=0;index--)
addItem(index);
getRows();
enableButtons(LeftNum,RightNum);
}
//刪除所有行
function deleteAll()
{
var i;
i=parent.frames.item("AddFunction").document.all.item("Tb").rows.length-1;
while (i>=1)
{
parent.frames.item("SelBut").document.all.item("RowID").value=parent.frames.item("AddFunction").document.all.item("Tb").rows(i).id;
deleteThis();
i--;
}
getRows();
enableButtons(LeftNum,RightNum);
}
//控制選擇按鈕的Diaabled屬性
function enableButtons(ileft,iright)
{
parent.frames.item("SelBut").document.all.item("btnRight").disabled=1;
parent.frames.item("SelBut").document.all.item("btnLeft").disabled=1;
parent.frames.item("SelBut").document.all.item("btnRightAll").disabled=(ileft>0?0:1);
parent.frames.item("SelBut").document.all.item("btnLeftAll").disabled=(iright>0?0:1);
}
//獲得當前的總行數
function getRows()
{
LeftNum=0;
RightNum=0;
if (parent.frames("FunctionList").document.all.tags("SELECT").length>0)
LeftNum=parent.frames.item("FunctionList").document.all.item("FunctionList").length;
if (parent.frames("AddFunction").document.all.tags("Table").length>0)
RightNum=parent.frames.item("AddFunction").document.all.item("Tb").rows.length-1;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -