我想从列中选择项目,并在单击时将其写入文件,以显示在包含文件的另一列中。
<table border="1" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="50%"><p><strong>FULL LIST</strong></p>
<span>type 1</span>
<span>type 2</span>
<span>type 3</span>
<span>type 4</span>
<span>etc...</span>
</td>
<td width="50%"><p><strong>SELECTED</strong></p><?php include 'list.inc'?></td>
</tr>
</table>
单击“类型1”等文件时会更新文件'list.inc'。每次附加一个新的字符串,当点击“SELECTED”列时,应该删除这个。
答案 0 :(得分:0)
$("document").ready(function()
{
$("#c1 , #c2").on("click", "span", function()
{
trnf($(this))
});
});
function trnf(eo)
{
var po=$(eo).parent().prop("id")
var tn=$(eo).prop("tagName");
var val=$(eo).html();
var ele="<"+tn+">"+val+"</"+tn+">";
$(eo).remove();
if(po=="c1")
{$("#c2").append(ele);}
else if(po=="c2")
{$("#c1").append(ele);}
}
&#13;
span:hover{ background-color:#3CC}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<tr>
<td id="c1" style="background-color:#09F; width:200px; height:200px;">
<span>type 1</span>
<span>type 2</span>
<span>type 3</span>
<span>type 4</span>
<span>type 5</span>
<span>type 6</span>
<span>type 7</span>
<span>type 8</span>
<span>type 9</span>
<span>type 0</span>
</td>
<td id="c2" style="background-color:#99F; width:200px; height:200px;">
</td>
</tr>
</table>
&#13;