thanks hansen. i can get the inline layers position from ns4's pageX
and pageY properties on a relative layer, but this does not work
outside of ns4 where i must use an absolute layer. so i have been able
to get a working method but its tragically klugy, requiring 2 dummy
layers and switch on the browser object [code follows] which works in
ns4,5,6 and ie4,5 on win.
please tell me there is a cleaner way to do this. i just want to find
the exact location on the page of the right-hand cell in this table.
it seems like a fairly common requirement.
a.g.h
<html>
<head>
<title>DynAPI Distribution: Inline Layers - Relative Position
Example</title>
<script language="Javascript" src="../src/dynapi.js"></script>
<script language="Javascript">
DynAPI.setLibraryPath('../src/lib/')
DynAPI.include('dynapi.api.*')
DynAPI.include('dynapi.ext.inline.js')
</script>
<script language="Javascript">
var dummy,dummy1,dummy2,myLayer;
DynAPI.onLoad=function() {
dummy1= this.document.getAll()['dummy1'];
dummy2= this.document.getAll()['dummy2'];
dummy=DynAPI.browser.ns4?dummy1:dummy2;
myLayer=new DynLayer();
myLayer.moveTo(dummy.getPageX(),dummy.getPageY());
myLayer.setBgColor('#FF0000');
myLayer.setHTML('My Layer');
myLayer.setVisible(true);
DynAPI.document.addChild(myLayer);
}
var i=100; while (i-->0) document.write('text ');
</script>
</head>
<body>
<center>
<table border=1 width="75%"><tr><td>here<br><br>here<br></td><td
valign=top>
<div id="dummy2" style="position:absolute;
visibility:hidden;"> </div>
<div id="dummy1" style="position:relative;
visibility:hidden;"> </div>
</td></tr></table>
</center>
</body>
</html>
Hansen Jakob Veje wrote:
> I just had some experiences with Netscape4.7 and relative layers. It looks
> like the layer.pageX and layer.pageY properties gives you what you are
> looking for: the div's position on the page.
>
> -----Original Message-----
> From: Andrew Hull
> To: dynapi-help
> Sent: 13-09-01 17:34
> Subject: [Dynapi-Help] relative positions
>
> im trying to figure out how to capture the position of an inline div to
> determine where the browsers layout engine chose to place page elements
> (especially in tables) so that i can place my own elements in relation
> to them. after some initial experiments with the inline extension, ive
> hit a few problems. ns4 has great difficulty placing a <div> with
> position:absolute set. it seems to place it at x=0 regardless of where
> in a table the <div> is found and the y seems like kind of a wild guess.
>
> if i use position:relative all is fine but then after creating the
> DynLayer reference with getAll() the getX() and getY() both return 0,
> relative to itself i suppose.
>
> should i simply avoid putting div's inside tables in NS4?
>
> i would appreciate being pointed to some info on this. one reference in
> the docs that looks promising is apparently a broken link:
>
> http://www.richardinfo.com/?menu=examples&node=8
> <http://www.richardinfo.com/?menu=examples&node=8>
>
> thx
> a.g.h
>
>
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dynapi-help
>
>
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help