?? selbtn.js
字號:
var LeftNum=0,RightNum=0;
//選擇按鈕<初始化
function roleSelectChange()
{
var index;
getRows();
parent.frames.item("SelBut").document.all.item("btnRight").disabled=1;
parent.frames.item("SelBut").document.all.item("btnLeft").disabled=0;
index=parent.frames.item("RoleList").document.all.item("RoleList").selectedIndex;
if (index>=0)
parent.frames.item("RoleList").document.all.item("RoleList").options(index).selected=false;
enableButtons(LeftNum,RightNum);
}
//增加一個
function addOne()
{
var optionLen,index;
index=parent.frames.item("RoleList").document.all.item("RoleList").selectedIndex;
optionLen=parent.frames.item("RoleSelect").document.all.item("RoleSelect").length;
parent.frames.item("RoleSelect").document.all.item("RoleSelect").length=optionLen+1;
parent.frames.item("RoleSelect").document.all.item("RoleSelect").options(optionLen).value=parent.frames.item("RoleList").document.all.item("RoleList").options(index).value;
parent.frames.item("RoleSelect").document.all.item("RoleSelect").options(optionLen).text=parent.frames.item("RoleList").document.all.item("RoleList").options(index).text;
parent.frames.item("RoleList").document.all.item("RoleList").remove(index);
parent.frames.item("SelBut").document.all.item("btnRight").disabled=1;
getRows();
enableButtons(LeftNum,RightNum);
}
//增加所有
function addAll()
{
parent.frames.item("SelBut").document.all.item("btnRightAll").disabled=1;
parent.frames.item("SelBut").document.all.item("btnLeftAll").disabled=0;
var optionLen,index;
for (index=parent.frames.item("RoleList").document.all.item("RoleList").length-1;index>=0;index--)
{
optionLen=parent.frames.item("RoleSelect").document.all.item("RoleSelect").length;
parent.frames.item("RoleSelect").document.all.item("RoleSelect").length=optionLen+1;
parent.frames.item("RoleSelect").document.all.item("RoleSelect").options(optionLen).value=parent.frames.item("RoleList").document.all.item("RoleList").options(index).value;
parent.frames.item("RoleSelect").document.all.item("RoleSelect").options(optionLen).text=parent.frames.item("RoleList").document.all.item("RoleList").options(index).text;
parent.frames.item("RoleList").document.all.item("RoleList").remove(index);
}
getRows();
enableButtons(LeftNum,RightNum);
}
//減少一個
function deleteOne()
{
var optionLen,index;
index=parent.frames.item("RoleSelect").document.all.item("RoleSelect").selectedIndex;
optionLen=parent.frames.item("RoleList").document.all.item("RoleList").length;
parent.frames.item("RoleList").document.all.item("RoleList").length=optionLen+1;
parent.frames.item("RoleList").document.all.item("RoleList").options(optionLen).value=parent.frames.item("RoleSelect").document.all.item("RoleSelect").options(index).value;
parent.frames.item("RoleList").document.all.item("RoleList").options(optionLen).text=parent.frames.item("RoleSelect").document.all.item("RoleSelect").options(index).text;
parent.frames.item("RoleSelect").document.all.item("RoleSelect").remove(index);
parent.frames.item("SelBut").document.all.item("btnLeft").disabled=1;
getRows();
enableButtons(LeftNum,RightNum);
}
//刪除所有
function deleteAll()
{
parent.frames.item("SelBut").document.all.item("btnLeftAll").disabled=1;
parent.frames.item("SelBut").document.all.item("btnRightAll").disabled=0;
var optionLen,index;
for (index=parent.frames.item("RoleSelect").document.all.item("RoleSelect").length-1;index>=0;index--)
{
optionLen=parent.frames.item("RoleList").document.all.item("RoleList").length;
parent.frames.item("RoleList").document.all.item("RoleList").length=optionLen+1;
parent.frames.item("RoleList").document.all.item("RoleList").options(optionLen).value=parent.frames.item("RoleSelect").document.all.item("RoleSelect").options(index).value;
parent.frames.item("RoleList").document.all.item("RoleList").options(optionLen).text=parent.frames.item("RoleSelect").document.all.item("RoleSelect").options(index).text;
parent.frames.item("RoleSelect").document.all.item("RoleSelect").remove(index);
}
getRows();
enableButtons(LeftNum,RightNum);
}
//控制選擇按鈕的Diaabled屬性
function enableButtons(ileft,iright)
{
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("RoleList").window.document.all.tags("SELECT").length>0)
LeftNum=parent.frames.item("RoleList").document.all.item("RoleList").length;
if (parent.frames("RoleSelect").window.document.all.tags("SELECT").length>0)
RightNum=parent.frames.item("RoleSelect").document.all.item("RoleSelect").length;
}
//
function init()
{
parent.frames("SelBut").LeftNum=0;
parent.frames("SelBut").RightNum=0;
if (parent.frames("RoleList").window.document.all.tags("SELECT").length>0)
parent.frames("SelBut").LeftNum=parent.frames.item("RoleList").document.all.item("RoleList").length;
if (parent.frames("RoleSelect").window.document.all.tags("SELECT").length>0)
parent.frames("SelBut").RightNum=parent.frames.item("RoleSelect").document.all.item("RoleSelect").length;
enableButtons(parent.frames("SelBut").LeftNum,parent.frames("SelBut").RightNum);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -