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

📄 select.js

📁 用jsp,servlet实现人力资源管理系统
💻 JS
字号:
function addSelectValue(sourceField, targetField) 
{	
	if (sourceField.options.length > 0) 
	{
		for(var i = 0; i < sourceField.options.length; i++) 
		{
			if(sourceField.options(i).selected) 
			{
			     put = 0;
                 if (targetField.options.length > 0)
                 {
	             	for (j = 0; j < targetField.options.length; j++)
	                {                                
	                	if (targetField.options(j).value == sourceField(i).value)
                        {
                       		put = 1;
                       		break;
                      	}
	                }
                 }
                 
                 if (put == 0)
				 	targetField.options[targetField.options.length] = new Option(sourceField.options(i).text, sourceField.options(i).value)
			}
		}
	}
}

function delSelectValue(sourceField) 
{
	if (sourceField.options.length > 0) 
	{		
		for(var i = sourceField.options.length - 1; i > -1; i--) 
		{
			if(sourceField.options(i).selected) 
			{				
		    	sourceField.options[i] = null
			}
		}
	}	
}

function selectAll(sourceField) 
{
	for(var i = 0; i < sourceField.options.length; i++) 
			sourceField.options(i).selected = true;	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -