-
appendItem(label,value )
- 戻り値の型: 要素
- 新しい項目を生成し、既存の項目リストの末尾に追加します。値の設定は任意です。この関数は新しく生成された要素を返します。
例
<script>
function addItemsToList() {
var list = document.getElementById('myMenuList');
// add item with just the label
list.appendItem('One');
// add item with label and value
list.appendItem('Two', 999);
// Select the first item
list.selectedIndex = 0;
}
</script>
<button label="Add items" oncommand="addItemsToList()" />
<menulist id="myMenuList">
<menupopup />
</menulist>