<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
无标题文档 #wrap{margin:20px auto;width: 500px;} #wrap li{list-style:none;padding:5px; font: 12px/1.5 tahoma,arial,"宋体",sans-serif; } //li上移 function UpLi(obj) { var onthis = $(obj).parent(); var getup = $(obj).parent().prev(); $(getup).before(onthis); } //li下移 function DownLi(obj) { var onthis = $(obj).parent(); var getdown = $(obj).parent().next(); $(getdown).after(onthis); } //ui上移 function upul(obj) { var onthis = $(obj).parent(); var getup = $(obj).parent().prev(); $(getup).before(onthis); } //ul下移 function downul(obj){ var onthis = $(obj).parent(); var getdown = $(obj).parent().next(); $(getdown).after(onthis); }
<ul>
faf<a href="#" onclick="return upul(this)">上移</a> <a href="#" onclick="return downul(this);">下移</a>
<li>顺序A <a href="#" onclick="return UpLi(this);">上移</a> <a href="#" onclick="return DownLi(this);">下移</a></li>
<li>顺序B <a href="#" onclick="return UpLi(this);">上移</a> <a href="#" onclick="return DownLi(this);">下移</a></li>
<li>顺序C <a href="#" onclick="return UpLi(this);">上移</a> <a href="#" onclick="return DownLi(this);">下移</a> <a href="#" onclick="return RemoveLi(this);"> 删除</a></li>
</ul>
<ul>gggg<a href="#" onclick="return upul(this)">上移</a> <a href="#" onclick="return downul(this);">下移</a>
<li>顺序d <a href="#" onclick="return UpLi(this);">上移</a> <a href="#" onclick="return DownLi(this);">下移</a></li>
<li>顺序e <a href="#" onclick="return UpLi(this);">上移</a> <a href="#" onclick="return DownLi(this);">下移</a></li>
<li>顺序f <a href="#" onclick="return UpLi(this);">上移</a> <a href="#" onclick="return DownLi(this);">下移</a> <a href="#" onclick="return RemoveLi(this);"> 删除</a></li>
</ul>
</div>