department.js
来自「教师办公管理系统是通过B/S结构搭建的平台」· JavaScript 代码 · 共 67 行
JS
67 行
function add()
{
var index = document.all.select1.selectedIndex;
if(index!=-1)
{
var value = document.all.select1.options[index].value;
var item = document.all.select1.options[index].text;
//检查是否有重复的
var bool = 0;
for(var i=0;i<document.all.select2.length;i++)
{
if(document.all.select2.options[i].value==value)
{
bool = 1;
break;
}
}
//添加
if(bool==0)
{
var oOption = document.createElement("OPTION");
document.all.select2.options.add(oOption);
oOption.innerText = item;
oOption.value = value;
}
}
}
function del()
{
var index = document.all.select2.selectedIndex;
if(index==-1)return;
document.all.select2.options.remove(index);
}
function addall()
{
//清空已选列表
var length = document.all.select2.length;
for(var i=0;i<length;i++)
{
document.all.select2.options.remove(0);
}
//添加全部列表
for(var i=0;i<document.all.select1.length;i++)
{
var item = document.all.select1.options[i].text;
var value = document.all.select1.options[i].value;
var oOption = document.createElement("OPTION");
document.all.select2.options.add(oOption);
oOption.innerText = item;
oOption.value = value;
}
}
function delall()
{
var length = document.all.select2.length;
for(var i=0;i<length;i++)
{
document.all.select2.options.remove(0);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?