表格的移动
<HTML>
<HEAD>
<TITLE>表格移动</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<script language="Javascript">
var beginMoving = false;
var canMove = true;
function setMove(obj)
{
canMove = obj;
}
function MouseDownToMove (obj)
{
if(!canMove)
return false;
obj.style.zIndex = 1;
obj.mouseDownY = event.clientY;
obj.mouseDownX = event.clientX;
beginMoving = true;
obj.setCapture ();
}
function MouseMoveToMove (obj)
{
if(!beginMoving) return false;
for (i = 0; i < obj.cells.length; i ++)
obj.cells [i].style.filter = "alpha(opacity = 70)";
obj.style.top = (event.clientY - obj.mouseDownY);
obj.style.left = (event.clientX - obj.mouseDownX);
}
function MouseUpToMove (obj)
{
if (!beginMoving) return false;
obj.releaseCapture ();
obj.style.top = 0;
obj.style.left = 0;
obj.style.zIndex = 0;
beginMoving = false;
var tempTop = event.clientY - obj.mouseDownY;
var tempRowIndex = (tempTop - tempTop % 25) / 25;
if (tempRowIndex + obj.rowIndex < 0 )
tempRowIndex = -1;
else
tempRowIndex = tempRowIndex+obj.rowIndex;
if (tempRowIndex >= obj.parentElement.rows.length - 1)
tempRowIndex = obj.parentElement.rows.length - 1;
for (i = 0; i < obj.cells.length; i ++)
obj.cells [i].style.filter = "alpha(opacity = 100)";
obj.parentElement.moveRow(obj.rowIndex, tempRowIndex);
}
</script>
<script language=javascript>
<!--//
function setButtonsOnClick(obj){
}
function selectallDisplay(obj) //全选或全不选
{
var tureorfalse=obj.checked;
var theDetail=tbdDistributions.rows;
for(var i=1;i<theDetail.length;i++)
{
if(tureorfalse)
{
theDetail[i].all("d.isDisplay").value= "Y";
}else
{
theDetail[i].all("d.isDisplay").value= "N";
}
}
}
function selectallDisplayControl(obj) //全选或全不选
{
var tureorfalse=obj.checked;
var theDetail=tbdDistributions.rows;
for(var i=1;i<theDetail.length;i++)
{
if(tureorfalse)
{
theDetail[i].all("d.isDisplayControl").value= "Y";
}else
{
theDetail[i].all("d.isDisplayControl").value= "N";
}
}
}
function selectType(obj) //选择类型
{
var theDetail=tbdDistributions.rows;
for(var i=1;i<theDetail.length;i++)
{
theDetail[i].all("d.type").value = obj.value;
}
}
//-->
</script>
</HEAD>
<BODY bgColor=#ffffff text=#000000 leftMargin=0 topMargin=10>
<form name=frm method=post action="userLayoutConfig.do">
<table width="96%" border="1" cellspacing="0" align="center" cellpadding="0">
<tbody id="tbdDistributions" onkeydown='keyDownControl(event.srcElement)'>
<tr>
<td width="30"> </td>
<td style="font-size:15pt">Field Id</td>
<td type=checkbox onclick="selectallDisplay(this);"></td>
<td onchange="selectType(this);">
<option value="view">View</option>
<option value="edit">Edit</option>
</select>
</td>
</tr>
<tr id="TrID1" style='height:25;position:relative;cursor:hand' onmousedown='MouseDownToMove(this)' onmousemove='MouseMoveToMove(this)' onmouseup='MouseUpToMove(this);'>
<td align=center>1</td>
<td name="d.fieldId" value="source" size=16>
<input type="hidden" name="d.layoutId" value="storeQuery_1">
</td>
<td onmousedown="setMove(false);" onblur="setMove(true);">
<option value="Y" selected>Y</option>
<option value="N" >N</option>
</select>
</td>
<td onmousedown="setMove(false);" onblur="setMove(true);">
<option value="view" selected>View</option>
<option value="edit" >Edit</option>
</select>
</td>
</tr>
<tr id="TrID2" style='height:25;position:relative;cursor:hand' onmousedown='MouseDownToMove(this)' onmousemove='MouseMoveToMove(this)' onmouseup='MouseUpToMove(this);'>
<td align=center>2</td>
<td name="d.fieldId" value="reference" size=16>
<input type="hidden" name="d.layoutId" value="storeQuery_2">
</td>
<td onmousedown="setMove(false);" onblur="setMove(true);">
<option value="Y" selected>Y</option>
<option value="N" >N</option>
</select>
</td>
<td onmousedown="setMove(false);" onblur="setMove(true);">
<option value="view" selected>View</option>
<option value="edit" >Edit</option>
</select>
</td>
</tr>
</tbody>
</table>
</form>
</BODY></HTML>