removeItemAt

This is an archived page. It's not actively maintained.

้–ข้€ฃๆƒ…ๅ ฑ

removeItemAt( index )
ๆˆปใ‚Šๅ€คใฎๅž‹: ่ฆ็ด 
่ฆ็ด ๅ†…ใฎๆŒ‡ๅฎšใ—ใŸ index ใฎๅญ้ …็›ฎใ‚’ๅ‰Š้™คใ—ใพใ™ใ€‚ใ“ใฎใƒกใ‚ฝใƒƒใƒ‰ใฏๅ‰Š้™คใ—ใŸ้ …็›ฎใ‚’่ฟ”ใ—ใพใ™ใ€‚
<script type="text/javascript">
function removeSelectedItem() {
  var myListBox = document.getElementById('myListBox');

  if(myListBox.selectedIndex == -1){
    return; // no item selected so return
  } else {
    myListBox.removeItemAt(myListBox.selectedIndex);
  }
}
</script>

<button label="Remove selected item" oncommand="removeSelectedItem()" />

<listbox id="myListBox">
  <listitem label="Alpha" />
  <listitem label="Beta" />
  <listitem label="Oscar" />
  <listitem label="Foxtrot" />
</listbox>