Gracias, Wikipedia.
ShareCode
Permalink: http://www.treeweb.es/u/974/ 01/02/2011

ShareCode

1 function log(s) {2  var d = document.getElementById('debug');3  d.innerHTML += '<br>' + s;4  5  if (s == 'clear') d.innerHTML = '';6  }7 8 function MagicMove(event) {9  var frame = document.getElementById('MagicFrame');10  var image = document.getElementById('MagicImage');11  12  var Lx = frame.clientWidth;13  var Ly = frame.clientHeight;14  var Mx = image.clientWidth;15  var My = image.clientHeight;16  var Cx = event['layerX'];17  var Cy = event['layerY'];18 19  image.style.marginLeft = '-'+((Mx-Lx)*Cx/Lx)+'px';20  image.style.marginTop = '-'+((My-Ly)*Cy/Ly)+'px';21 22  log('clear');23  log (event['layerX']+', '+event['layerY']);24  log (Lx);25  log (Mx);26 27 }28 29 function MagicOut(event) {30  var image = document.getElementById('MagicImage');31  image.style.marginLeft = '';32  image.style.marginTop = '';33 }
Enlace
El enlace para compartir es:

Powered by TreeWeb
© TreeWeb 2010. Todos los derechos reservados