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

📄 department.js

📁 这是一个大学生论文管理系统,采用JSP语言进行开发
💻 JS
字号:

	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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -