hi all,
if that can help somebody....
feedback welcome
<html>
<head>
<style type="text/css">
blockquote{ border:1px solid red;margin:15px ;padding:2px;}
div{border:1px solid blue; margin:2px; padding:2px;}
</style>
<script language="javas cript" >
if(self.Node) {
Node.prototype. swapNode = function(n){
var p = n.parentNode;
var s = n.nextSibling;
this.parentNode .replaceChild(n ,this);
p.insertBefore( this,s);
return this;
}
}
function is_all_ws( nod )
{
// Use ECMA-262 Edition 3 String and RegExp features
return !(/[^\t\n\r ]/.test(nod.data) );
}
function is_ignorable( nod ){
return ( nod.nodeType == 8) || // A comment node
( (nod.nodeType == 3) && is_all_ws(nod) ); // a text node, all ws
}
function node_before( sib ){
while ((sib = sib.previousSib ling)) {
if (!is_ignorable( sib))
return sib;
}
return null;
}
function node_after( sib ){
while ((sib = sib.nextSibling )) {
if (!is_ignorable( sib))
return sib;
}
return null;
}
function move( obj, direction ){
while( obj.nodeName != "BLOCKQUOTE " )
obj = obj.parentNode;
if( direction == 1 && obj != obj.parentNode. lastChild ){
var cur = obj;
while (cur){
if (cur.nodeName == "BLOCKQUOTE "){
obj.swapNode( cur )
}
cur = node_after(cur) ;
}
}
if( direction == -1 && obj != obj.parentNode. firstChild ){
var cur = obj;
while (cur){
if (cur.nodeName == "BLOCKQUOTE "){
obj.swapNode( cur )
}
cur = node_before(cur );
}
}
}
</script>
</head>
<body>
<div id="root">
<blockquote>
<a href="javascrip t:void(0)" onclick="move(t his, -1)">up</a>
<a href="javascrip t:void(0)" onclick="move(t his, 1)">down</a>
<input type="text" name="field" value="1">
</blockquote>
<blockquote>
<a href="javascrip t:void(0)" onclick="move(t his, -1)">up</a>
<a href="javascrip t:void(0)" onclick="move(t his, 1)">down</a>
<input type="text" name="field" value="2">
</blockquote>
</div>
</body>
</html>
if that can help somebody....
feedback welcome
<html>
<head>
<style type="text/css">
blockquote{ border:1px solid red;margin:15px ;padding:2px;}
div{border:1px solid blue; margin:2px; padding:2px;}
</style>
<script language="javas cript" >
if(self.Node) {
Node.prototype. swapNode = function(n){
var p = n.parentNode;
var s = n.nextSibling;
this.parentNode .replaceChild(n ,this);
p.insertBefore( this,s);
return this;
}
}
function is_all_ws( nod )
{
// Use ECMA-262 Edition 3 String and RegExp features
return !(/[^\t\n\r ]/.test(nod.data) );
}
function is_ignorable( nod ){
return ( nod.nodeType == 8) || // A comment node
( (nod.nodeType == 3) && is_all_ws(nod) ); // a text node, all ws
}
function node_before( sib ){
while ((sib = sib.previousSib ling)) {
if (!is_ignorable( sib))
return sib;
}
return null;
}
function node_after( sib ){
while ((sib = sib.nextSibling )) {
if (!is_ignorable( sib))
return sib;
}
return null;
}
function move( obj, direction ){
while( obj.nodeName != "BLOCKQUOTE " )
obj = obj.parentNode;
if( direction == 1 && obj != obj.parentNode. lastChild ){
var cur = obj;
while (cur){
if (cur.nodeName == "BLOCKQUOTE "){
obj.swapNode( cur )
}
cur = node_after(cur) ;
}
}
if( direction == -1 && obj != obj.parentNode. firstChild ){
var cur = obj;
while (cur){
if (cur.nodeName == "BLOCKQUOTE "){
obj.swapNode( cur )
}
cur = node_before(cur );
}
}
}
</script>
</head>
<body>
<div id="root">
<blockquote>
<a href="javascrip t:void(0)" onclick="move(t his, -1)">up</a>
<a href="javascrip t:void(0)" onclick="move(t his, 1)">down</a>
<input type="text" name="field" value="1">
</blockquote>
<blockquote>
<a href="javascrip t:void(0)" onclick="move(t his, -1)">up</a>
<a href="javascrip t:void(0)" onclick="move(t his, 1)">down</a>
<input type="text" name="field" value="2">
</blockquote>
</div>
</body>
</html>
Comment