[Javascript] Q on SELECT Options

Walter Torres walter at torres.ws
Thu Feb 6 18:54:11 CST 2003


I have 2 lists.

I am trying to make it so that when you select an item in LIST_A, the item
selected in LIST_B (if any) is deselected and the focus to stay in LIST_A.

This is what I have, but it's not working.

Thanks

walter

<select name='master' size='7' onFocus='setListFocus(this)'>
   ... options here
</select>

// global to store what list is currently in focus
var objFocusList;

// Set Focus and remove focus from other List
function setListFocus ( objList )
{
	if ( objList == objFocusList)
		return

	if ( typeof ( objFocusList ) == 'object' )
		objFocusList.options[objFocusList.selectedIndex].selected = false;

	objFocusList = objList;
}




More information about the Javascript mailing list