Hi all.,
I have a <select> box with lot of <options>. I want to add a selected <options> with another <select> box once click a add button. Now i can add one by one.But once i selected more than one options, still it is adding one, remaining all are deleted. I want add to another select box once selected more than one options also. Any can help me. Here i am putting my JavaScript code. Thanks in advance. Regs. senthil <html:button property="next" styleClass="buttonwidthlarge" value=">>" onclick="addMapping(this.form.taskList, this.form.mappingTask);" tabindex="12"/><br/> // This function gets called when ADD button clicked function addMapping(objSourceElement, objTargetElement) { if (objSourceElement.selectedIndex == -1) { alert("Please select the tasks from the Available Tasks"); return; } var aryTempSourceOptions = new Array(); var x = 0; var intTargetLen = objTargetElement.length++; //populate the mapping name list box with CSV file column and the sample field column objTargetElement.options[intTargetLen].text = objSourceElement.options[objSourceElement.selectedIndex].text; objTargetElement.options[intTargetLen].value = objSourceElement.options[objSourceElement.selectedIndex].value; //This is to recreate the fileheaders list box for (var i = 0; i < objSourceElement.length; i++) { if (!objSourceElement.options[i].selected) { var objTempValues = new Object(); objTempValues.text = objSourceElement.options[i].text; objTempValues.value = objSourceElement.options[i].value; aryTempSourceOptions[x] = objTempValues; x++; } } objSourceElement.length = aryTempSourceOptions.length; for (var i = 0; i < aryTempSourceOptions.length; i++) { objSourceElement.options[i].text = aryTempSourceOptions[i].text; objSourceElement.options[i].value = aryTempSourceOptions[i].value; } x = 0; aryTempSourceOptions = new Array(); objSourceElement.selectedIndex = -1; } This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient or received it in error, please contact the sender by reply e-mail and destroy all copies of the original message. Please do not copy it for any purpose or disclose its contents. Copyright Tarang Software Technologies Pvt. Ltd. 2004. All rights Reserved