具體實(shí)現(xiàn)的源碼如下:
兩個(gè)框的頁(yè)面源碼:
已選角色:<br /> <select multiple="multiple" name="roleIds" size="10" id="roleIds"> <option value="1"> 主任 </option> <option value="2"> 醫(yī)師 </option><option value="3"> 護(hù)士 </option><option value="4"> 前臺(tái) </option><o
實(shí)現(xiàn)的js代碼:
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; } } }
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注