如:// JScript 文件
var ms=0;
var msp=0;
var lmtleft=0;
var lmttop=0;
var lmtheight=0;
var lmtwidth=0;
function did(obj,obj1)
{
ms=obj;
msp=obj1;
lmtleft=document.all(msp).style.pixelLeft;
lmttop=document.all(msp).style.pixelTop;
lmtheight=document.all(msp).scrollHeight;
lmtwidth=document.all(msp).scrollWidth;
event.srcElement.setCapture();
x=document.all(ms).style.pixelLeft-event.x;
y=document.all(ms).style.pixelTop-event.y;
}
function document.onmousemove()
{
if(ms!="")
{
document.all(ms).style.pixelLeft=x+event.x;
document.all(ms).style.pixelTop=y+event.y;
if (document.all(ms).style.pixelLeft<lmtleft)
{ document.all(ms).style.pixelLeft=lmtleft;}
if (document.all(ms).style.pixelTop<lmttop)
{ document.all(ms).style.pixelTop=lmttop;}
if (document.all(ms).style.pixelTop>(lmttop+lmtheight))
{ document.all(ms).style.pixelTop=(lmttop+lmtheight-10)}
if (document.all(ms).style.pixelLeft>(lmtleft+lmtwidth))
{ document.all(ms).style.pixelLeft=(lmtleft+lmtwidth-10)} }
} function document.onmouseup()
{
if(ms!="")
{
event.srcElement.releaseCapture();
ms=0;
}
}
我在c#中用sql语句更新 for (int i = 0; i < WellStateArr.Length; i++)
{
string sql = "";
sql = "update well_style set welltop='ddd',wellleft='+fff+ "' where wellbzid='" + WellStateArr[i].WellID + "'"; SqlCommand cmd = new SqlCommand(sql, conn);
cmd.ExecuteNonQuery ();
}
ddd,fff 分别对应着js文件中的x,y
var ms=0;
var msp=0;
var lmtleft=0;
var lmttop=0;
var lmtheight=0;
var lmtwidth=0;
function did(obj,obj1)
{
ms=obj;
msp=obj1;
lmtleft=document.all(msp).style.pixelLeft;
lmttop=document.all(msp).style.pixelTop;
lmtheight=document.all(msp).scrollHeight;
lmtwidth=document.all(msp).scrollWidth;
event.srcElement.setCapture();
x=document.all(ms).style.pixelLeft-event.x;
y=document.all(ms).style.pixelTop-event.y;
}
function document.onmousemove()
{
if(ms!="")
{
document.all(ms).style.pixelLeft=x+event.x;
document.all(ms).style.pixelTop=y+event.y;
if (document.all(ms).style.pixelLeft<lmtleft)
{ document.all(ms).style.pixelLeft=lmtleft;}
if (document.all(ms).style.pixelTop<lmttop)
{ document.all(ms).style.pixelTop=lmttop;}
if (document.all(ms).style.pixelTop>(lmttop+lmtheight))
{ document.all(ms).style.pixelTop=(lmttop+lmtheight-10)}
if (document.all(ms).style.pixelLeft>(lmtleft+lmtwidth))
{ document.all(ms).style.pixelLeft=(lmtleft+lmtwidth-10)} }
} function document.onmouseup()
{
if(ms!="")
{
event.srcElement.releaseCapture();
ms=0;
}
}
我在c#中用sql语句更新 for (int i = 0; i < WellStateArr.Length; i++)
{
string sql = "";
sql = "update well_style set welltop='ddd',wellleft='+fff+ "' where wellbzid='" + WellStateArr[i].WellID + "'"; SqlCommand cmd = new SqlCommand(sql, conn);
cmd.ExecuteNonQuery ();
}
ddd,fff 分别对应着js文件中的x,y
或者用ajax,xmlhttp