Updating List Box

I have a frameset with two frames which is accessible via the web: Menu and Body.

The menu frame has a dialog list, which contains a list of names. Below this list, there are a number of menu options, one being Add Name.

When the user clicks the Add Name link, a AddName form opens in the Body frame. Here the enter adds a new name, along with additional information. When the user clicks OK to continue, the document is saved and the user is then required to ented contact information (associated with the name just stored).

Once the users saves the document, I would like to add the new name to the bottom of the list in the Menu frame, and then have it be the selected item.

Now I am using the following:

parent.Menu.document.forms[0].AName.options[parent.Menu.document.forms[0].AName.selectedIndex].text = document.forms[0].AcquisitionName.value;

This adds the name to the first element in the list. How can I determine the last index in the list, add the new name and then have it be the selected list item?

Any ideas or suggestions would be greatly appreciated - Thanks in advance.

Subject: Updating List Box

Got it!

var a = parent.Menu.document.forms[0].AName.length;

parent.Menu.document.forms[0].AName.options[a] = new Option(document.forms[0].AcquisitionName.value);

parent.Menu.document.forms[0].AName.options(a).selected = true;