Hi All,
Can any one please look into the following code and tell me where I went
wrong
<html>
<head>
<script language="JavaS cript">
function transferItem(sr cId, destId) {
var destObj = document.getEle mentById(destId );
var srcObj = document.getEle mentById(srcId) ;
for(var i=0; i<srcObj.length ; i++)
if(srcObj.optio ns[i].selected) {
var srcTxt = srcObj.options[i].text;
var srcVal = srcObj.options[i].value;
var newOpt = document.create Element("OPTION ");
newOpt.text = srcTxt;
newOpt.value = srcVal;
destObj.add(new Opt, null);
}
for(var i=0; i<srcObj.length ; i++) {
if(srcObj.optio ns[i].selected) {
srcObj.remove(i );
}
}
}
</script>
<body>
<table width="100%" height="335">
<tr>
<td width="33%" height="329">
<select name="sourceSel ect" id="sourceSelec t" size="4" Multiple>
<option value ="volvo">Vol vo</option>
<option value ="saab">Saab </option>
<option value ="opel">Opel </option>
<option value ="audi">Audi </option>
</select>
</td>
<td width="33%" height="329">
<button onClick='transf erItem("sourceS elect","destSel ect")'> Add
</button>
<br>
<br>
<button onClick='transf erItem("destSel ect","sourceSel ect")'> Remove
</button>
</td>
<td width="33%" height="329">
<select name="destSelec t" id="destSelect " size="3" Multiple>
</select>
</td>
</tr>
</table>
</body>
</html>
Actually I have written the script to transfer the selected options
single/multiple(contig uous/non-contiguous) from source select box
to destination select box and vice versa.
This code is working fine in NN6+, the problem is when I'm selecting
contiguous options from source/destination select
box and click on add/remove button I'm gettting problem not all selected
options are deleted from source select box.
Sorry for lengthy mail.
Thanks in advance
Can any one please look into the following code and tell me where I went
wrong
<html>
<head>
<script language="JavaS cript">
function transferItem(sr cId, destId) {
var destObj = document.getEle mentById(destId );
var srcObj = document.getEle mentById(srcId) ;
for(var i=0; i<srcObj.length ; i++)
if(srcObj.optio ns[i].selected) {
var srcTxt = srcObj.options[i].text;
var srcVal = srcObj.options[i].value;
var newOpt = document.create Element("OPTION ");
newOpt.text = srcTxt;
newOpt.value = srcVal;
destObj.add(new Opt, null);
}
for(var i=0; i<srcObj.length ; i++) {
if(srcObj.optio ns[i].selected) {
srcObj.remove(i );
}
}
}
</script>
<body>
<table width="100%" height="335">
<tr>
<td width="33%" height="329">
<select name="sourceSel ect" id="sourceSelec t" size="4" Multiple>
<option value ="volvo">Vol vo</option>
<option value ="saab">Saab </option>
<option value ="opel">Opel </option>
<option value ="audi">Audi </option>
</select>
</td>
<td width="33%" height="329">
<button onClick='transf erItem("sourceS elect","destSel ect")'> Add
</button>
<br>
<br>
<button onClick='transf erItem("destSel ect","sourceSel ect")'> Remove
</button>
</td>
<td width="33%" height="329">
<select name="destSelec t" id="destSelect " size="3" Multiple>
</select>
</td>
</tr>
</table>
</body>
</html>
Actually I have written the script to transfer the selected options
single/multiple(contig uous/non-contiguous) from source select box
to destination select box and vice versa.
This code is working fine in NN6+, the problem is when I'm selecting
contiguous options from source/destination select
box and click on add/remove button I'm gettting problem not all selected
options are deleted from source select box.
Sorry for lengthy mail.
Thanks in advance
Comment