Content interchange in two jsp boxes and jsp content Interchange

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.