2011-07-28 13 views
0

ドロップダウンリストから削除する必要がある値をクリックすると1つのドロップダウンリストが作成されます。別のフィールドにストアします。 そのフィールドの値をダブルクリックすると、溺れたリスト javascriptとhtmlを使用したドロップダウンリスト

は私にいくつかのアイデアを与えてください

+0

問題は何ですか?動作していないコードを表示してください。 – Paul

+0

これまでに何を試しましたか?このためにJQueryのサンプルを検索してみてください。 – legendofawesomeness

+0

私はちょうど私が、Javaスクリプトやjqueryを使用するwheatherを考えていた始めた。okおかげで私はjqueryをteyします。 –

答えて

1

簡単な例です:Webページに有用のような上記のものを作るために必要な非常に多くがあるもちろん

<script type="text/javascript"> 

function handleClick(e, listElement) { 

    // Get the element that was clicked on 
    var el = e.target || e.srcElement; 

    // If the element has class 'item' ... 
    if (el && /item/.test(el.className)) { 

    // Move it from its current list to the other one 
    if (listElement.id == 'list-0') { 
     document.getElementById('list-1').appendChild(el); 

    } else { 
     document.getElementById('list-0').appendChild(el); 
    } 
    } 
} 

</script> 

<ul id="list-0" onclick="handleClick(event, this);"> 
    <li class="item">apple 
    <li class="item">orange 
    <li class="item">banana 
</ul> 

<ul id="list-1" onclick="handleClick(event, this);"> 
    <li>add stuff here... 
</ul> 

+0

ありがとうございます。 –

関連する問題