2011-07-28 50 views
0

我已創建1名下拉列表當我點擊它應該從下拉菜單ñ存儲在另一個字段中刪除.. 值當我雙擊該字段中的值,它應該回到淹死的名單。下拉列表

給我一些想法,請

+0

什麼問題?請顯示無法使用的代碼。 – Paul

+0

你有什麼到目前爲止已經試過?嘗試搜索並探索JQuery示例。 – legendofawesomeness

+0

我剛開始我想wheather使用Java腳本或jQuery的..好,謝謝,我會使用jQuery泰伊。 –

回答

1

一個簡單的例子是:

<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

非常感謝。 –