Content interchange in two jsp boxes and jsp content Interchange
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: <br/> <select multiple = "multiple" name = "roleIds" size = "10" id = "roleIds"> <option value = "1"> Director </option> <option value = "2"> physician </option> <option value = "3"> nurse </option> <option value = "4"> front-end </option> <option value = "5"> Internal Service </option> </select> <input type = "button" value = "<-Add" onclick = "moveOptions (document. getElementById ('rolelist'), document. getElementById ('rolekids'); "/> <input type =" button "value =" Remove-> "class =" btn1 "onclick =" moveOptions (document. getElementById ('roleids '), document. getElementById ('rolelist'); "/> <br/> alternative roles: <br/> <select multiple = "multiple" size = "10" id = "roleList"> <option value = "6"> Engineer 1 </option> <option value = "7"> engineer 2 </option> <option value = "8"> engineer 3 </option> <option value = "9"> Engineer 4 </option> <option value = "10"> engineer 5 </option> <option value = "11"> engineer 6 </option> </select>
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;}}}
Dome source code: http://download.csdn.net/detail/zl544434558/7992709
In jsp, how does one verify whether the content of the two text boxes in the form is consistent without buttons?
Js implementation:
<Input id = "t1" type = "input" onblur = "but ()"/>
<Input id = "t2" type = "input" onblur = "but ()"/>
<Script>
Function (){
Var val1 = document. getElementById ('t1'). value;
Var val2 = document. getElementById ('t2'). value;
If (val1! = Val2 ){
Alert ("t1 and t2 values not equal ");
}
}
</Script>
How to compile content exchange in two text boxes in VB
'Introduce the third string variable st
Dim st as string
St = text1.text
Text1.text = text2.text
Text2.text = st