Ciao,

ho questo script:

<style>
<!--
.drag {position: relative; cursor: move;}
-->
</style>
<script>
//COORDINATE ELEMNTO
function getPageCoords (element) {
var coords = {x: 0, y: 0};
while (element) {
coords.x += element.offsetLeft;
coords.y += element.offsetTop;
element = element.offsetParent;
}
return coords;
}
// FINE COORDINATE ELEMENTO


// spostamento div nell' area
var ie=document.all
var ns6=document.getElementById&&!document.all
var dragapproved=false
var z,x,y
var p

function move(e){
if (dragapproved){
zleft=ns6? temp1+e.clientX-x: temp1+event.clientX-x
ztop=ns6? temp2+e.clientY-y: temp2+event.clientY-y
pleft=parseInt(p.style.left+0)
ptop=parseInt(p.style.top+0)
pright=parseInt(p.style.left+0)+parseInt(p.style.w idth+0)-parseInt(z.style.width+0)
pbottom=parseInt(p.style.top+0)+parseInt(p.style.h eight+0)-parseInt(z.style.height+0)
if (zleft>=pleft&&zleft<pright)
z.style.left=ns6? temp1+e.clientX-x+'px': temp1+event.clientX-x;
if (ztop>=ptop&&ztop<pbottom)
z.style.top=ns6? temp2+e.clientY-y+'px': temp2+event.clientY-y;
return false
}
}

function drags(e){
if (!ie&&!ns6)
return
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "HTML" : "BODY"
while (firedobj.tagName!=topelement.toUpperCase() && firedobj.className.indexOf("drag")<0) {
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.className.indexOf("drag")>=0){
dragapproved=true
z=firedobj
p=ns6? firedobj.parentNode : firedobj.parentElement
temp1=parseInt(z.style.left+0)
temp2=parseInt(z.style.top+0)
x=ns6? e.clientX: event.clientX
y=ns6? e.clientY: event.clientY
document.onmousemove=move
return false
}
}
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")
//Fine spostamento div
</script>

<table border='1'>
<tr>
<td style="position: relative;width: 450px; height: 250px;">
<div style="position:absolute; width: 64px; height: 48px;" class="drag">
[img]static/img/area.jpg[/img]
</div>
</td></tr>
</table>

<script>
imgresize = "";
function keydown(e) {
if(typeof(e)!="undefined") event = e;
if(!event.keyCode && event.which) event.keyCode = event.which;
if(document.layers) {
var tasti = new Array();
tasti[92] = tasti[124] = 220;
tasti[39] = tasti[63] = 219;
tasti[236] = tasti[94] = 221;
tasti[232] = tasti[233] = tasti[91] = tasti[123] = 186;
tasti[43] = tasti[42] = tasti[93] = tasti[125] = 187;
tasti[242] = tasti[231] = tasti[64] = 192;
tasti[224] = tasti[176] = tasti[35] = 222;
tasti[249] = tasti[167] = 191;
tasti[60] = tasti[62] = 226;
tasti[44] = tasti[59] = 188;
tasti[46] = tasti[58] = 190;
tasti[45] = tasti[95] = 189;
tasti[47] = 111;
tasti[42] = 106;
tasti[45] = 109;
tasti[43] = 107;
tasti[33] = 49;
tasti[34] = 50;
tasti[163] = 51;
tasti[36] = 52;
tasti[37] = 53;
tasti[38] = 54;
tasti[40] = 56;
tasti[41] = 57;
tasti[61] = 48;
if(event.keyCode >= 97 && event.keyCode <= 122)
event.keyCode -= 32;
else if(tasti[event.keyCode])
event.keyCode = tasti[event.keyCode];
}
resizeImg(event.keyCode);
}

if(document.captureEvents) document.captureEvents(Event.KEYDOWN);
document.onkeydown = keydown;


function resizeImg(t) {
var i = document.images[imgresize], w, h, delay=5;
if(!i || !imgresize) return;
w = i.width;
h = i.height;
if(t==187 || t==107)
i.width+=delay;
else if(t==189 || t==109)
i.width-=delay;
i.height = Math.round(i.width*h/w);
}
</script>


quando io ridimensiono l' immagine con i tasti + o -, mi esce dall' area che delimita lo spostamento, inoltre non coincide bene con i bordi, come mai?

qualcuno mi aiuta?

grazie