|
A bit hard tosay when you do not submit any code... oor browser type ..
Following are no problem in IE + FireFox:
<html>
<head>
<script language="JavaScript" type="text/javascript">
function moveItemx() {
var s_from = document.getElementById('s_from');
var s_to = document.getElementById('s_to');
var m_index = s_from.selectedIndex;
if(s_from.options.length && s_from.selectedIndex>-1)
{
s_to.options[s_to.length]= new Option(s_from.options[m_index].text,s_from.options[m_index].value );
s_from.options[m_index] = null;
}
}
</script>
</head>
<body>
<select size="5" id="s_from" ondblclick="moveItemx()">
<option value="op1">OPTION_1</option>
<option value="op2">OPTION_2</option>
<option value="op3">OPTION_3</option>
<option value="op4">OPTION_4</option>
<option value="op5">OPTION_5</option>
<option value="op6">OPTION_6</option>
<option value="op7">OPTION_7</option>
<option value="op8">OPTION_8</option>
<option value="op9">OPTION_9</option>
<option value="op10">OPTION_10</option>
<option value="op11">OPTION_11</option>
<option value="op12">OPTION_12</option>
</select>
<select size="5" id="s_to">
<option value="opc">OPTION_C</option>
</select>
<input type="button" onclick="javascript:moveItemx();" value="Move">
</body>
</html>
|
|
|
- anyway i guess this helps:
(run after the element has ben removed)
for(i=s_from.length;i>=0;i--)
s_from.selectedIndex = i;
|
|
|
Sorry...it is in IE. Here is our Move function currently (I haven't tried any of your suggestions yet):
//***************************************************************
//* Function Name: move
//*
//* Description: This function moves the selected item from the
//* aobjFromSelect to the aobjToSelect. It then uses
//* aintToMaxCount and other attributes to set other
//* "state" information.
//*
//***************************************************************
function move(aobjFromSelect, aobjToSelect, aobjClickedButton, aobjOtherButton, aintToMaxCount)
{
var lobjOption = document.createElement("OPTION");
var lintFromIndex = aobjFromSelect.selectedIndex;
var lintToIndex;
lobjOption.value = aobjFromSelect.options(lintFromIndex).value;
lobjOption.text = aobjFromSelect.options(lintFromIndex).text;
aobjFromSelect.options.remove(lintFromIndex);
for (lintToIndex = 0; lintToIndex < aobjToSelect.options.length; lintToIndex++)
if (lobjOption.text < aobjToSelect.options(lintToIndex).text)
break;
aobjToSelect.options.add(lobjOption, lintToIndex);
aobjToSelect.selectedIndex = lintToIndex;
if (aobjOtherButton.disabled)
aobjOtherButton.disabled = false;
if (aobjFromSelect.options.length == 0)
{
if (aobjOtherButton.visible)
aobjOtherButton.focus();
//Null
aobjClickedButton.disabled = true;
}
else
{
if (lintFromIndex < aobjFromSelect.options.length)
aobjFromSelect.selectedIndex = lintFromIndex;
else
aobjFromSelect.selectedIndex = aobjFromSelect.options.length - 1;
if (aintToMaxCount > 0 && aobjToSelect.options.length == aintToMaxCount)
{
if (aobjOtherButton.visible)
aobjOtherButton.focus();
aobjClickedButton.disabled = true;
}
}
if (viewFields.homeOffView.value == "N" &&
(aobjFromSelect.name == "availableSecFirmCodes" ||
aobjToSelect.name == "availableSecFirmCodes"))
{
if (availableSecFirmCodes.options.length == 0)
{
secFirmAddAll.disabled = true;
}
else
{
secFirmAddAll.disabled = false;
}
}
return 0;
}
|
|
|
|
|
|
|
|