Home > Backend Development > PHP Tutorial > jQuery实现列表上下移动并且带入数据库

jQuery实现列表上下移动并且带入数据库

WBOY
Release: 2016-06-23 13:25:39
Original
931 people have browsed it


这是页面的上下移动功能,怎么能把移动后的顺序带入数据库

下面是js代码:

<script> <br />$(function(){ <br />var $up = $(".up") <br />$up.click(function() { <br />var $tr = $(this).parents("tr"); <br />if ($tr.index() != 0) { <br />$tr.fadeOut().fadeIn(); <br />$tr.prev().before($tr); <br /> <br />} <br />}); <br />var $down = $(".down"); <br />var len = $down.length; <br />$down.click(function() { <br />var $tr = $(this).parents("tr"); <br />if ($tr.index() != len - 1) { <br />$tr.fadeOut().fadeIn(); <br />$tr.next().after($tr); <br />} <br />}); <br />var $top = $(".top"); <br />$top.click(function(){ <br />var $tr = $(this).parents("tr"); <br />$tr.fadeOut().fadeIn(); <br />$(".table").prepend($tr); <br />$tr.css("color","#f60"); <br />}); <br />}); <br /></script>

求各位大神帮帮忙,已经卡住好几天了


回复讨论(解决方案)

<script src=scripts/jquery-1.8.3.min.js></script><table><tr><td class='xh'>1</td><td class='up'>上移</td><td class='down'>下移</td></tr><tr><td class='xh'>2</td><td class='up'>上移</td><td class='down'>下移</td></tr><tr><td class='xh'>3</td><td class='up'>上移</td><td class='down'>下移</td></tr><tr><td class='xh'>4</td><td class='up'>上移</td><td class='down'>下移</td></tr><tr><td class='xh'>5</td><td class='up'>上移</td><td class='down'>下移</td></tr><tr><td class='xh'>6</td><td class='up'>上移</td><td class='down'>下移</td></tr></table><input type=button value=确认 id=bn><script language="JavaScript" type="text/javascript">$(function(){  $('#bn').click(function() {    var r = [];    $('.xh').each(function(i, t) {      r.push($(this).html());    });    alert(r);    //$.post(url, {xh:r});  });  var $up = $(".up")  $up.click(function() {    var $tr = $(this).parents("tr");    if ($tr.index() != 0) {      $tr.fadeOut().fadeIn();      $tr.prev().before($tr);    }  });  var $down = $(".down");  var len = $down.length;  $down.click(function() {    var $tr = $(this).parents("tr");    if ($tr.index() != len - 1) {      $tr.fadeOut().fadeIn();      $tr.next().after($tr);    }  });  var $top = $(".top");  $top.click(function(){    var $tr = $(this).parents("tr");    $tr.fadeOut().fadeIn();    $(".table").prepend($tr);    $tr.css("color","#f60");  });});</script>
Copy after login

这个能带入数据库么?   

你只要把变化后的数据传到 php,如何入库就是 php 的事情了

您能不能给我给邮箱或者QQ   我有问题想咨询您

你只要把变化后的数据传到 php,如何入库就是 php 的事情了

 
这个要怎么传到php啊    怎么做?   求指教
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template