Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

drop down in mozilla firefox is not working

843838Mar 28 2007 — edited May 24 2007
hi,
i am new to javascript.i am getting an problem in mozilla firefox(Mozilla/5.0 Firefox/2.0.0.2).i am sending the piece of code. dropdown in IE is working fine when u click on up or down button.but problem occuring is in mozilla it is not moving down(dropdown)it is sticking on the top itself...plz check the code and help in giving the solution for it....
<html>
<head>
<script type="text/javascript">


function moveUp(frm)
{
    if(frm.FieldlocatorSelectedList.selectedIndex!=null && frm.FieldlocatorSelectedList.selectedIndex!=-1)
    {
    if (frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex].index > 0)
    {
        var selValue = frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex].value;
        var selText = frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex].text;
        var topValue = frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex-1].value;
        var topText = frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex-1].text;
        frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex].value=topValue;
        frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex].text=topText;
        frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex-1].value=selValue;
        frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex-1].text=selText;
        var ct=frm.FieldlocatorSelectedList.selectedIndex
        frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex].selected=false;
        frm.FieldlocatorSelectedList.options[ct-1].selected=true;
    }
    else
    {
        alert ('Can\'t move up.  Top item is selected');
    }
    }

}

function moveDown(frm)
{
    if(frm.FieldlocatorSelectedList.selectedIndex!=null && frm.FieldlocatorSelectedList.selectedIndex!=-1)
    {
        if (frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex].index <
        (frm.FieldlocatorSelectedList.length-1))
        {
            var selValue = frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex].value;
            var selText = frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex].text;
            var topValue = frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex+1].value;
            var topText = frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex+1].text;
            frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex].value=topValue;
            frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex].text=topText;
			frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex+1].value=selValue;
            frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex+1].text=selText;
            var ct=frm.FieldlocatorSelectedList.selectedIndex;
            frm.FieldlocatorSelectedList.options[frm.FieldlocatorSelectedList.selectedIndex].selected=false;	   
            frm.FieldlocatorSelectedList.options[ct+1].selected=true;
        }
        else
        {
            alert ('Can\'t move down.  Bottom item is selected');
        }
    }
}
</script>
</head>
<body>
<form name="addInfoFrm">
<td class="bodytextbld" width="250">
<select id="FieldlocatorSelectedList" multiple="" name="selectedList" size="10">
<option value="OWNR_1_LABEL=Owner 1 Label($ 0.0/M)">Owner 1 Label($ 0.0/M)</option>
<option value="OWNR_1_LAST_NAME=Owner 1 Last Name($ 0.0/M)">Owner 1 Last Name($ 0.0/M)</option>
<option value="OWNR_1_FIRST_NAME=Owner 1 First Name($ 0.0/M)">Owner 1 First Name($ 0.0/M)</option>
<option value="OWNR_1_MIDDLE_NAME=Owner 1 Middle Name($ 0.0/M)">Owner 1 Middle Name($ 0.0/M)</option>
<option value="OWNR_2_LABEL=Owner 2 Label($ 0.0/M)">Owner 2 Label($ 0.0/M)</option>
<option value="OWNR_1_NAME_SFX=Owner 1 Suffix($ 0.0/M)">Owner 1 Suffix($ 0.0/M)</option>
<option value="OWNR_2_LAST_NAME=Owner 2 Last Name($ 0.0/M)">Owner 2 Last Name($ 0.0/M)</option>
<option value="OWNR_2_FIRST_NAME=Owner 2 First Name($ 0.0/M)">Owner 2 First Name($ 0.0/M)</option>
<option value="OWNR_2_MIDDLE_NAME=Owner 2 Middle Name($ 0.0/M)">Owner 2 Middle Name($ 0.0/M)</option>
<option value="OWNR_2_NAME_SFX=Owner 2 Suffix($ 0.0/M)">Owner 2 Suffix($ 0.0/M)</option>
<option value="OWNR_CARE_OF_NAME=Owner Care Of($ 0.0/M)">Owner Care Of($ 0.0/M)</option>
<option value="MAIL_ADDR_TXT=Mail Address($ 0.0/M)">Mail Address($ 0.0/M)</option>
<option value="MAIL_ADDR_CITY=Mail City($ 0.0/M)">Mail City($ 0.0/M)</option>
<option value="MAIL_ADDR_STATE=Mail State($ 0.0/M)">Mail State($ 0.0/M)</option>
<option value="MAIL_ADDR_ZIP_CODE=Mail Zip($ 0.0/M)">Mail Zip($ 0.0/M)</option>
<option value="MAIL_ADDR_ZIP_4=Mail Zip+4($ 0.0/M)">Mail Zip+4($ 0.0/M)</option>
<option value="MAIL_ADDR_CARR_RTE=Mail Carrier Route($ 0.0/M)">Mail Carrier Route($ 0.0/M)</option>
<option value="PROPERTY_ADDRESS=Property Address($ 0.0/M)">Property Address($ 0.0/M)</option>
<option value="SITE_HOUSE_NBR=Property House Number($ 0.0/M)">Property House Number($ 0.0/M)</option>
<input  type="button" onclick="moveUp(document.addInfoFrm)" value="Up"/>
<input  type="button" onclick="moveDown(document.addInfoFrm)" value="Down"/>
</select>
</form>
</body>
</html>
plz help me in that.........
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 21 2007
Added on Mar 28 2007
5 comments
117 views