Manes como se hace para que las filas de una se puedan mover y rehubicar, me baje este codigo pero no funciona
Código HTML:
Ver original tr, tr td {
border: 1px #999999 solid;
border-bottom: 2px #999999 solid;
background-color: #FFFFFF;}
tr.underline, tr.underline td {
border-bottom: 2px #000000 solid;
background-color: #CCCCCC;}
<script type="text/javascript"> var draggingRow = false;
var sourceRow = null;
function startedDragging()
{
draggingRow = true;
sourceRow = event.srcElement.parentNode.parentNode;
}
function dragEnter()
{
if (draggingRow) window.event.returnValue = false;
}
function dragOver()
{
if (draggingRow)
{
var targetRow = event.srcElement;
while (targetRow.parentNode != null && targetRow.tagName && targetRow.tagName.toLowerCase() != 'tr')
targetRow = targetRow.parentNode;
targetRow.className = 'underline';
window.event.returnValue = false;
}
}
function dragLeave()
{
if (draggingRow)
{
var targetRow = event.srcElement;
while (targetRow.parentNode != null && targetRow.tagName && targetRow.tagName.toLowerCase() != 'tr')
targetRow = targetRow.parentNode;
targetRow.className = '';
}
}
function dropped()
{
if (draggingRow)
{
targetRow = event.srcElement;
while (targetRow.parentNode != null && targetRow.tagName && targetRow.tagName.toLowerCase() != 'tr')
targetRow = targetRow.parentNode;
targetRow.className = '';
sourceRow.swapNode(targetRow);
draggingRow = false;
}
}
var iconForDragging = '#define icon_width 4\n#define icon_height 4\nstatic char icon_bits[] = { 0x05, 0x0A, 0x05, 0x0A };';
<body ondrop="dropped();"> <table id="dragDropTable" border="0" cellpadding="2" cellspacing="0"> <tr ondragenter="dragEnter();" ondragover="dragOver();" ondragleave="dragLeave();"> <td><img src="javascript:iconForDragging;" width="16" height="16" ondragstart="startedDragging();"></td> <tr ondragenter="dragEnter();" ondragover="dragOver();" ondragleave="dragLeave();" ondrop="dropped();"> <td><img src="javascript:iconForDragging;" width="16" height="16" ondragstart="startedDragging();"></td> <tr ondragenter="dragEnter();" ondragover="dragOver();" ondragleave="dragLeave();" ondrop="dropped();"> <td><img src="javascript:iconForDragging;" width="16" height="16" ondragstart="startedDragging();"></td>
Saludos