RE: [xsl] element coordinates in html output

Subject: RE: [xsl] element coordinates in html output
From: "Arthur Bogaart" <Arthur@xxxxxxxx>
Date: Tue, 5 Mar 2002 12:33:36 +0100
Hi Maros,

As far as I know it's quite easy in ie5+. You should give the elements you would like to access an id attribute. Then you'll be able to get their x,y coordinates like this.

document.getElementById(elementId).style.posLeft;

and

document.getElementById(elementId).style.posTop;

For more information see http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/postop.asp?frame=true


In netscape 4.x you'll only have coordinates access to <div/>,<span/>,<layer/> and <ilayer/> tags. 
In netscape6 this should do the trick.
var leftpos = parseInt(document.getElementById(elementId).style.left);

For more netscape info see
http://developer.netscape.com/evangelism/docs/articles/updating-dhtml-web-pages/#codefork
http://www.mozilla.org/docs/dom/domref/

If you're only consurned about positioning layers (div/span/layer) you could also take a look at the DynAPI. http://dynapi.sourceforge.net It's a Cross-Browser DHTML Library.


> Hi,
>      I need to get the coordinates of any of html elements in 
> XSLT output. I tried to use JavaScript Anchor.x property, but 
> it seams that either netscape nor mozilla nor IE nor Opera 
> does implement JavaScript 1.2 properly.
> 
> Does anybody know the way to get the coordinates?
> 
> Thanks in advance.
> 
> 	Maros Ivanco.


kind regards,

Arthur Bogaart

Hippo Webworks
Grasweg 35
1031 HW Amsterdam
Tel  +31 (0)20 6345173 
Fax +31 (0)20 6345179

arthur@xxxxxxxx / www.hippo.nl
 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread