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

📄 selbut.js

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