2011-07-28 43 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

非常感谢。 –