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

📄 selbtn.js

📁 本系统的使用可以将工作的部分流程使用计算机的办公自动化处理
💻 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 + -