最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時間:2008年11月20日 23:12:06   作者:  
拉表格,一個函數(shù)調(diào)用即可
JS: 
復制代碼 代碼如下:

/*
@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;
}
}
}

示例: 
復制代碼 代碼如下:

<!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>無標題文檔</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ù)組中對應元素的方法

    JavaScript通過元素索引號刪除數(shù)組中對應元素的方法

    這篇文章主要介紹了JavaScript通過元素索引號刪除數(shù)組中對應元素的方法,涉及javascript操作數(shù)組的技巧,非常具有實用價值,需要的朋友可以參考下
    2015-03-03
  • javascript實現(xiàn)的左右無縫滾動效果

    javascript實現(xiàn)的左右無縫滾動效果

    這篇文章主要介紹了javascript實現(xiàn)的左右無縫滾動效果,可實現(xiàn)左右平滑無縫滾動的效果,并且可響應鼠標滑過而停止?jié)L動,非常簡便實用,需要的朋友可以參考下
    2016-09-09
  • 配置eslint規(guī)范項目代碼風格

    配置eslint規(guī)范項目代碼風格

    這篇文章主要介紹了配置eslint規(guī)范項目代碼風格,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-03-03
  • three.js 利用uv和ThreeBSP制作一個快遞柜功能

    three.js 利用uv和ThreeBSP制作一個快遞柜功能

    這篇文章主要介紹了three.js 利用uv和ThreeBSP制作一個快遞柜,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-08-08
  • JavaScript Event學習第五章 高級事件注冊模型

    JavaScript Event學習第五章 高級事件注冊模型

    在這一章我會講解兩種高級時間注冊模型:W3C和微軟的。因為這兩個方法都不能跨瀏覽器,所以在現(xiàn)在看來他們的使用場合并不多。
    2010-02-02
  • 如何獲取元素的最終background-color

    如何獲取元素的最終background-color

    本文主要介紹了如何獲取元素的最終background-color的方法,具有一定的參考價值,下面跟著小編一起來看下吧
    2017-02-02
  • 基于js 本地存儲(詳解)

    基于js 本地存儲(詳解)

    下面小編就為大家?guī)硪黄趈s 本地存儲(詳解)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-08-08
  • JavaScript 實現(xiàn)下雪特效的示例代碼

    JavaScript 實現(xiàn)下雪特效的示例代碼

    這篇文章主要介紹了JavaScript 實現(xiàn)下雪特效的示例代碼,幫助大家利用JavaScript制作特效,感興趣的朋友可以了解下
    2020-09-09
  • ES6新特性三: Generator(生成器)函數(shù)詳解

    ES6新特性三: Generator(生成器)函數(shù)詳解

    這篇文章主要介紹了ES6新特性之Generator(生成器)函數(shù),簡單分析了Generator(生成器)函數(shù)的功能、定義、調(diào)用方法并結(jié)合實例形式給出了相關使用技巧,需要的朋友可以參考下
    2017-04-04
  • 詳解uni-app中的樣式

    詳解uni-app中的樣式

    這篇文章主要為大家介紹了uni-app中的樣式,具有一定的參考價值,感興趣的小伙伴們可以參考一下,希望能夠給你帶來幫助
    2021-11-11

最新評論

交口县| 柳江县| 嘉峪关市| 突泉县| 衡阳市| 洛隆县| 洞头县| 永平县| 新晃| 海安县| 韶关市| 南漳县| 揭西县| 南昌县| 嘉荫县| 宝山区| 安阳县| 密山市| 庆城县| 平安县| 方城县| 东乌珠穆沁旗| 淳安县| 专栏| 巫溪县| 铜陵市| 屯昌县| 务川| 恩施市| 宣化县| 江西省| 红原县| 泽库县| 安图县| 洪泽县| 阳朔县| 拉孜县| 土默特右旗| 普兰县| 静海县| 随州市|