一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

拖拉表格的JS函數(shù)

JS: 
復(fù)制代碼 代碼如下:
/*
@parem object the tbody's object
@parem object tr's object (must be null)
@parem string the className of onmousedown
@parem string the className of onmouseout
*/
function order(tt,old,classover,classout) {
var sf = arguments.callee; //get the function self
var trs = tt.getElementsByTagName('tr');
for(var i=0;i<trs.length;i++) {
trs[i].onmousedown = function () {
if(this.style.cursor == 'move') {
return false;
}
classout = this.className;
this.className = classover;
this.style.cursor = 'move';
old = this;
}
trs[i].onmouseover = function () {
if(this.style.cursor == 'move' || !old) {
return false;
}
var tmp_old = old.cloneNode(true);
var tmp_now = this.cloneNode(true);
var p = this.parentNode;
p.replaceChild(tmp_now,old);
p.replaceChild(tmp_old,this);
sf(tt,tmp_old,classover,classout);
}
trs[i].onmouseout = function () {
//this.className = classout;
}
trs[i].onmouseup = function () {
this.className = classout;
this.style.cursor = '';
old = null;
}
}
}

示例: 
復(fù)制代碼 代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無(wú)標(biāo)題文檔</title>
</head>
<script src="js/ajax.js"></script>
<script src="js/global.js"></script>
<style type="text/css">
.table {
background-color:red;
}
.table td {
background-color:#eeeeee;
}
.now td{
background-color:red;
}
</style>
<script type="text/Javascript">
<!--
window.onload = function () {
order(document.getElementById('tt'),null,"now");
}
/*
@parem object the tbody's object
@parem object tr's object (must be null)
@parem string the className of onmousedown
@parem string the className of onmouseout
*/
function order(tt,old,classover,classout) {
var sf = arguments.callee; //get the function self
var trs = tt.getElementsByTagName('tr');
for(var i=0;i<trs.length;i++) {
trs[i].onmousedown = function () {
if(this.style.cursor == 'move') {
return false;
}
classout = this.className;
this.className = classover;
this.style.cursor = 'move';
old = this;
}
trs[i].onmouseover = function () {
if(this.style.cursor == 'move' || !old) {
return false;
}
var tmp_old = old.cloneNode(true);
var tmp_now = this.cloneNode(true);
var p = this.parentNode;
p.replaceChild(tmp_now,old);
p.replaceChild(tmp_old,this);
sf(tt,tmp_old,classover,classout);
}
trs[i].onmouseout = function () {
//this.className = classout;
}
trs[i].onmouseup = function () {
this.className = classout;
this.style.cursor = '';
old = null;
}
}
}
//-->
</script>
<body>
<table border="0" cellpadding="0" cellspacing="1" class="table">
<tbody>
<tr >
<td>ID</td>
<td>記錄</td>
</tr>
</tbody>
<tbody id="tt">
<tr >
<td>1</td>
<td>記錄</td>
</tr>
<tr>
<td>2</td>
<td>記錄</td>
</tr>
<tr>
<td>3</td>
<td>記錄</td>
</tr>
<tr>
<td>4</td>
<td>記錄</td>
</tr>
</tbody>
</table>
</body>
</html>

JavaScript技術(shù)拖拉表格的JS函數(shù),轉(zhuǎn)載需保留來(lái)源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 亚洲综合激情另类小说区 | 全国最大色成免费网站 | 欧美日韩中文一区二区三区 | 91久久精品日日躁夜夜躁欧美 | 激情小视频在线播放免费 | 亚洲伦理中文字幕一区 | 国产精品一区二区免费 | 国产区成人综合色在线 | 欧美日韩国产超高清免费看片 | 欧美亚洲国产另类 | 伊人青草 | 日本人视频18jizz免费 | 激情丁香网 | 欧美成人精品欧美一级乱黄 | 国产成人精品视频 | 在线观看中文字幕一区 | 亚洲热在线视频 | 91年精品国产福利线观看久久 | 男女朋友做爽爽爽免费视频网 | 婷婷色中文 | 国产精品白浆在线播放 | 91免费资源网站入口 | 国产麻豆自拍 | 免费国产在线观看不卡 | 四色最新网址 | 国产在线毛片 | 午夜一级 | 甘城光辉游乐园在线观看 | 美女胸又www又黄的网站视频 | 成人综合在线视频免费观看 | 中文字幕在线观看日韩 | 成年香蕉大黄美女美女 | 在线视频一区二区三区在线播放 | 国产精彩对白综合视频 | 夜色网| 四虎4hu新地址入口 四虎4hu亚洲精品 | 最近最新中文字幕在线第一页 | 91aaa免费观看在线观看资源 | 久久精品国产99久久 | 中文字幕在线视频在线看 | 久青草国产视频 |