Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: List Box validation- are any items selected


Message #1 by sg48@y... on Mon, 3 Dec 2001 14:56:59
--0-476643329-1007469215=:99120
Content-Type: text/plain; charset=us-ascii


If the selectedIndex property of the list (select element) is -1 the select object doesn't contain any selected item. 
if(document.all("select1").selectedIndex == -1)
{
  alert("No selection!");
}
else
{
  alert(document.all("select1").options[document.all("select1").selectedIndex].innerText);
}

  sg48@y... wrote: How do you tell if no selections have been made in a list box. I have tried 
a number of approaches with no success.



---------------------------------
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.

  Return to Index