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

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

 更新時(shí)間:2008年11月20日 23:12:06   作者:  
拉表格,一個(gè)函數(shù)調(diào)用即可
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>

相關(guān)文章

  • JavaScript通過(guò)元素索引號(hào)刪除數(shù)組中對(duì)應(yīng)元素的方法

    JavaScript通過(guò)元素索引號(hào)刪除數(shù)組中對(duì)應(yīng)元素的方法

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

    javascript實(shí)現(xiàn)的左右無(wú)縫滾動(dòng)效果

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

    配置eslint規(guī)范項(xiàng)目代碼風(fēng)格

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

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

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

    JavaScript Event學(xué)習(xí)第五章 高級(jí)事件注冊(cè)模型

    在這一章我會(huì)講解兩種高級(jí)時(shí)間注冊(cè)模型:W3C和微軟的。因?yàn)檫@兩個(gè)方法都不能跨瀏覽器,所以在現(xiàn)在看來(lái)他們的使用場(chǎng)合并不多。
    2010-02-02
  • 如何獲取元素的最終background-color

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

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

    基于js 本地存儲(chǔ)(詳解)

    下面小編就為大家?guī)?lái)一篇基于js 本地存儲(chǔ)(詳解)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-08-08
  • JavaScript 實(shí)現(xiàn)下雪特效的示例代碼

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

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

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

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

    詳解uni-app中的樣式

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

最新評(píng)論

佛冈县| 东宁县| 沾化县| 太保市| 绍兴市| 武安市| 库尔勒市| 西藏| 鲁甸县| 阳信县| 镇原县| 霍州市| 曲松县| 邹城市| 工布江达县| 镶黄旗| 德江县| 平利县| 乃东县| 垣曲县| 大连市| 漳州市| 奎屯市| 扶沟县| 逊克县| 伊通| 通许县| 盈江县| 天长市| 武山县| 兴宁市| 邮箱| 嘉黎县| 甘孜| 屏边| 榆树市| 湖南省| 涿鹿县| 天津市| 兴山县| 小金县|