var moveX = 0;
var moveY = 0;
var moveTop = 0;
var moveLeft = 0;
var flag = false;
tr.onmousedown = function()
{
var e = window.event;
flag = true;
moveX = e.clientX;
moveY = e.clientY;
moveTop = parseInt(newDiv.style.top);
moveLeft = parseInt(newDiv.style.left);
document.onmousemove = function()
{
if(flag)
{
var e = window.event;
var x = moveLeft + e.clientX - moveX;
var y = moveTop + e.clientY - moveY;
if(x > 0 && (x + newWidth < iWidth) && y > 0 && (y + newHeight < iHeight))
{
newDiv.style.left = x + "px";
newDiv.style.top = y + "px";
}
}
}
document.onmouseup = function()
{
if(flag)
{
var moveX = 0;
var moveY = 0;
var moveTop = 0;
var moveLeft = 0;
flag = false;
}
}
}
var mes = table.insertRow(table.rows.length);
var mestd = mes.insertCell(0);
mestd.style.cssText = "color:red;text-align:center;";
mestd.innerHTML = "姓名:<input type = 'text'/><br>密码:<input type = 'text'/><br><input type = 'submit' value = '提交'>";
}