diff options
Diffstat (limited to 'files/ja/archive/mozilla/xul/method/insertitemat/index.html')
| -rw-r--r-- | files/ja/archive/mozilla/xul/method/insertitemat/index.html | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/files/ja/archive/mozilla/xul/method/insertitemat/index.html b/files/ja/archive/mozilla/xul/method/insertitemat/index.html deleted file mode 100644 index 1fd4533c77..0000000000 --- a/files/ja/archive/mozilla/xul/method/insertitemat/index.html +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: insertItemAt -slug: Archive/Mozilla/XUL/Method/insertItemAt -tags: - - XUL Methods - - XUL Reference -translation_of: Archive/Mozilla/XUL/Method/insertItemAt ---- -<div class="noinclude"> - <span class="breadcrumbs XULRefMeth_breadcrumbs">« <a href="/ja/docs/XUL_Reference" title="/ja/docs/XUL_Reference">XUL リファレンス HOME</a></span></div> -<dl> - <dt><span id="m-insertItemAt"><code><a href="https://developer.mozilla.org/ja/docs/Mozilla/Tech/XUL/Method/insertItemAt">insertItemAt( index, label, value )</a></code></span></dt> - <dd>戻り値の型: <em>要素</em></dd> - <dd>このメソッドは新しい項目を生成し、それを指定した位置に挿入します。値の設定は任意です。新しい項目要素を返します。</dd> -</dl> - -<div class="noinclude"> - <p><strong>注意:</strong> 存在しない <var>index</var> に項目を挿入することはできません。例: <code>element.getRowCount() + 1</code> で末尾に項目を挿入する。</p> - <h3 id="Example" name="Example">例</h3> - <pre class="brush:js"><!-- This example inserts at the selected item or appends, then selects the newly created item --> -<script language="javascript"> -function insertItemToList() { - var myListBox = document.getElementById('myListBox'); - - // create a date to get some labels and values - var someDate = new Date(); - - if(myListBox.selectedIndex == -1){ - // no item was selected in list so append to the end - myListBox.appendItem( someDate.toLocaleTimeString(), someDate.getTime() ); - var newIndex = myListBox.getRowCount() -1 - } else { - // item was selected so insert at the selected item - var newIndex = myListBox.selectedIndex; - myListBox.insertItemAt(newIndex, someDate.toLocaleTimeString(), someDate.getTime()); - } - - // select the newly created item - myListBox.selectedIndex = newIndex; -} -</script> - -<button label="Insert item at selected" oncommand="insertItemToList()" /> - -<listbox id="myListBox"> - <listitem label="foo" /> -</listbox> -</pre> - - <h3 id="See_also" name="See_also">関連情報</h3> -<ul> - <li><a href="/ja/docs/XUL/Method/appendItem"><code>appendItem()</code></a></li> - <li><a href="/ja/docs/XUL/Method/removeItemAt"><code>removeItemAt()</code></a></li> -</ul> - -</div> |
