jQuery实现列表上下移动并且带入数据库
这是页面的上下移动功能,怎么能把移动后的顺序带入数据库
下面是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>
这个能带入数据库么?
你只要把变化后的数据传到 php,如何入库就是 php 的事情了
您能不能给我给邮箱或者QQ 我有问题想咨询您
你只要把变化后的数据传到 php,如何入库就是 php 的事情了
这个要怎么传到php啊 怎么做? 求指教

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov
