E' possibile ricavare con certezza il top e il left di un'immagine da javascript???
E' possibile ricavare con certezza il top e il left di un'immagine da javascript???
Tutta sta gente che guarda e nessuno che risponde???
Semplicemente perchè la tua domanda non è chiara, forse.
come faccio a sapere il top e il left di un <img> mentre sono in un javascript???
Ma che vuol dire top e left di un'immagine?? Rispetto a cosa??
L'immagine al max ha un'altezza ed una larghezza....
rispetto allo 0,0 del document..
oh...scusate...c ho pensato adesso che questa è la sezione HTML...proverò a chiedere in quella di JavaScript...cmq se qualcuno sa come fare..tengo controllato anche qui...Grazie
a nessuno è venuta una brillante idea su come fare????
ho trovato con google.... :quipy:
codice:<script type="text/javascript"> // this function returns the x, y position // works in IE and Mozilla. function getElementPosition(element){ var x=0,y=0; while (element!=null){ x+=element.offsetLeft-element.scrollLeft; y+=element.offsetTop-element.scrollTop; element=element.offsetParent; } return {x:x,y:y}; } // Browser compatible element getter function getElement(id){ if (document.all) return document.all[id]; if (document.getElementById(id)) return document.getElementById(id); return null; } // generic display function function findElement(id){ // Get the element by its id element = getElement(id); // make sure that the element was found if (! element) return; // get the object that will contain the x,y coordinates position = getElementPosition(element); // display the coordinates alert('x: ' + position.x + '\n\ny: ' + position.y); } </script>
Heaven's closed. Hell sold out.
Linux 2.6.26-2-amd64
Debian squeeze
ma fra l'altro c'e` un thread fra i primi sul forum js che rimanda qui:
http://forum.html.it/forum/showthrea...hreadid=530318
nn l'hai visto?