JQuery-tableDnD 拖拽的基本使用
来源:互联网 发布:网络推广职业规划面试 编辑:程序博客网 时间:2024/05/17 07:08
jquery-1.3.2.min.js
jquery.tablednd_0_5.js
注意:一定要先导入jquery-1.3.2.min.js 否则出错。
·建table
<table id="table-1" cellspacing="0" cellpadding="2">
<tr id="1"><td>1</td><td>One</td><td>some text</td></tr>
<tr id="2"><td>2</td><td>Two</td><td>some text</td></tr>
<tr id="3"><td>3</td><td>Three</td><td>some text</td></tr>
<tr id="4"><td>4</td><td>Four</td><td>some text</td></tr>
<tr id="5"><td>5</td><td>Five</td><td>some text</td></tr>
<tr id="6"><td>6</td><td>Six</td><td>some text</td></tr>
</table>
·插入js代码
<script type="text/javascript">
$(document).ready(function() {
$("#table-1").tableDnD();
});
</script>
·ok。
·例子
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
pageContext.setAttribute("basePath", basePath);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript"
src="${basePath}common/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript"
src="${basePath}common/js/jquery.tablednd_0_5.js"></script>
<style type="text/css">
.aa {
background: #00FF99
}
.bb {
background: #0066FF
}
</style>
<script type="text/javascript">
$(document).ready(function() {
color();
$("#table-1").tableDnD({
onDrop:function(table,row){
var b = $(row).children().eq(0).text();
color();
}
});
});
function color()
{
var tbody = $("table[id='table-1'] tr");
tbody.each(function(index){
var cc = index%2;
if(0==cc)
{
$(this).removeClass();
$(this).addClass("aa");
}
else
{
$(this).removeClass();
$(this).addClass("bb");
}
});
}
</script>
</head>
<body>
<table id="table-1" cellspacing="0" cellpadding="2">
<tr id="1"><td>1</td><td>One</td><td>some text</td></tr>
<tr id="2"><td>2</td><td>Two</td><td>some text</td></tr>
<tr id="3"><td>3</td><td>Three</td><td>some text</td></tr>
<tr id="4"><td>4</td><td>Four</td><td>some text</td></tr>
<tr id="5"><td>5</td><td>Five</td><td>some text</td></tr>
<tr id="6"><td>6</td><td>Six</td><td>some text</td></tr>
</table>
</body>
</html>
- JQuery-tableDnD 拖拽的基本使用
- JQuery-tableDnD 拖拽的基本使用
- jquery.tableDnd
- tableDnD实现table里行的拖拽排序
- jquery tableDnD 实现行拖拽
- jQuery 表格拖动插件:tableDnD
- jquery 拖动排序插件tableDnD
- jquery 基本选择器的使用
- jquery alert的基本使用
- jquery的基本使用语法
- jquery基本选择器的使用
- jQuery选择器的基本使用
- jQuery基本选择器的使用
- jquery validate的基本使用
- Jquery.DataTable的基本使用
- 使用jQuery 插件 tablesorter 的基本使用
- 使用Jquery进行基本的客户端校验
- jquery 中ajax的基本使用
- redhat装安装盘里的GCC
- Job的map任务分配
- c++中类型与对象同名的问题
- C++ socket编程基础
- JAVA中int、String的类型转换
- JQuery-tableDnD 拖拽的基本使用
- 职业规划解决方案
- Oracle 基本操作
- C++ 虚函数表解析
- Grep学习笔记
- 记分析病毒时遇到的跟IE相关的注册表项
- 复合词分离
- 结构之法 算法之道
- oracel 启动和关闭 DB