/    Sign up×
Community /Pin to ProfileBookmark

move row up and down through javascript pop-up menu

i want to move row up and down through javascript pop-up menu . for example each row have a link “move row” . when i click on “move row” link pop-up menu open with the link “move up” or “move down” to solve this problem help me

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@sridhar_423Jul 06.2006 — a masterpeice ...

pls dont ask me to explain this code ... searched for you ..

better send a message to "KOR".

[code=php]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Sortare ascendenta/descendenta pe coloane</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<style type="text/css">
<!--
tr {
background-color: #CCCCCC;
}
.tr1 {
background-color: #F5F5F5;
}
.tr2 {
background-color: #E5E5E5;
}
.point {
cursor:pointer;
}
-->
</style>
<script type="text/JavaScript">
[COLOR=Red][B]//Genuine code by Corneliu Lucian 'KOR' Rusu -- mailto:corneliulucian(AROND)apropo.ro[/B][/COLOR]

function sortIt(w){

var r=w.parentNode.parentNode.getElementsByTagName('tr');

var oRows = new Array()//clone lines
var iRows = new Array()//index lines

for(var i=1;i<r.length;i++){
oRows[i]=r[i].cloneNode(true);
iRows[i]=r[i].rowIndex;
}

var q=w.cellIndex;
var oCol = new Array()
var vCol = new Array()

for(var i=0;i<iRows.length;i++){
var v = r[i].cells[q].firstChild.nodeValue;
if(Number(v))
v=Number(v)

oCol[i]=[v,iRows[i]];
vCol[i]=[v,iRows[i]];
}

oCol.shift();
vCol.shift();

sCol = oCol.sort(function(oCol,sCol){return oCol[0] == sCol[0] ? 0 : (oCol[0] < sCol[0] ? -1 : 1)});
if(vCol.toString()==sCol.toString())
sCol.reverse();// switch down/up

var q=1;
for(var i=1;i<r.length;i++){//rewrite lines
r[i].parentNode.replaceChild(oRows[sCol[i-1][1]],r[i]);
//START zebra
q=(q>2)?1:q
r[i].className='tr'+q;q++;
// END zebra
}

//switch arrows
var s =['desc.gif','cres.gif','none.gif'];//arrows url
var allS =r[0].getElementsByTagName('img');
var sag = w.getElementsByTagName('img')[0];
var url =(sag.getAttribute('src').indexOf(s[1])>-1||sag.getAttribute('src').indexOf(s[2])>-1)?s[0]:s[1];
sag.setAttribute('src',url);

for(var i=0;i<allS.length;i++)//init arraows
if(allS[i]!=sag)
allS[i].setAttribute('src',s[2])

}
</script>
</head>
<body>
<table width="400" border="0" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td class="point" onclick="sortIt(this)" title="Sort"><strong>NAME</strong> <img src="none.gif" border="0" alt=""></td>
<td class="point" onclick="sortIt(this)" title="Sort"><strong>ID</strong> <img src="none.gif" border="0" alt=""></td>
<td class="point" onclick="sortIt(this)" title="Sort"><strong>Lvl</strong> <img src="none.gif" border="0" alt=""></td>
<td class="point" onclick="sortIt(this)" title="Sort"><strong>Rank</strong> <img src="none.gif" border="0" alt=""></td>
<td class="point" onclick="sortIt(this)" title="Sort"><strong>Position</strong> <img src="none.gif" border="0" alt=""></td>
</tr>
<tr class="tr1">
<td>Maha</td>
<td>19923</td>
<td>100</td>
<td>100</td>
<td>Owner</td>
</tr>
<tr class="tr2">
<td>Thrawl</td>
<td>9550</td>
<td>159</td>
<td>100</td>
<td>Co-Owner</td>
</tr>
<tr class="tr1">
<td>Marhanen</td>
<td>22304</td>
<td>83</td>
<td>99</td>
<td>Banker</td>
</tr>
</tbody>
</table>
</body>
</html>[/code]
Copy linkTweet thisAlerts:
@copypasteauthorJul 06.2006 — i want to exact "my yahoo " or "my msn" page .
×

Success!

Help @copypaste spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...