Content interchange in two jsp boxes
The following effects must be implemented in the project.
The specific implementation source code is as follows:
Page source code in two boxes:
Selected roles:DirectorPhysicianNurseFront-endInqin> Class = btn1onclick = moveOptions (document. getElementById ('roleids '), document. getElementById ('rolelist');/> alternative roles:Engineer 1Engineer 2Engineer 3Engineer 4Engineer 5Engineer 6
Implemented js Code:
function moveOptions(oSource, oTarget) {while (oSource.selectedIndex > -1) {var opt = oSource.options[oSource.selectedIndex];oSource.removeChild(opt);var mark = true;for(var i = 0; i < oTarget.options.length; i++){if(opt.value == oTarget.options[i].value){mark = false;}}if(mark){var newOpt = document.createElement(OPTION);oTarget.appendChild(newOpt);newOpt.value = opt.value;newOpt.text = opt.text;newOpt.selected = true;}}}