一区二区久久-一区二区三区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>無標(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)載需保留來源!

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

主站蜘蛛池模板: 福利视频欧美 | 免费视频一区 | 成人精品综合免费视频 | 欧美一级久久 | 国产美女精品久久久久久久免费 | 国产精品第一页在线观看 | 视频免费1区二区三区 | 91久久麻豆 | 青青热久久国产久精品 | 四虎国产永久免费久久 | 五月婷香 | 久久亚洲国产成人精品性色 | 国产极品麻豆91在线 | 免费永久国产在线视频 | 亚洲综合激情网 | 久久麻豆亚洲精品 | 热久久国产欧美一区二区精品 | chinese麻豆自制国产 | 最新国产一区二区精品久久 | 国产拳头交一区二区 | 五月激情综合网 | 337p欧洲亚洲大胆艺术 | 亚洲二区在线 | 国产波波社区精品视频 | 91原创视频在线观看 | 欧美xxxx做受欧美人妖 | 最近中文字幕完先锋资源 | 日本三级成人中文字幕乱码 | 亚洲综合激情九月婷婷 | 国产精品国产自线拍手机观看 | 在线色网站 | 国产小视频在线高清播放 | 日韩欧美一区黑人vs日本人 | a高清免费毛片久久 | 国产在视频线精品视频www666 | 六月婷婷激情 | 天天爽天天乐 | 国产三级级在线观看大学生 | 亚洲男人的天堂久久香蕉 | 中文字幕123区 | 四虎国产精品免费久久久 |