reposition DIV element

G

Guest

I am tring to flow a DIV element to the position where a row in a table
is clicked. I use the following javascript to caculate the mouse
position. The X and Y of the mouse is calculated correctly, but the DIV
does not flow there. The DIV always anchors top left corner of the
table, no matter how many far down the row is clicked. Does anyone know
why? Thanks.

<xsl:template match="/">
<form>
....
<xsl:apply-templates select="/adminrights/adminright"/>
</form>

<script language="JavaScript">
<![CDATA[
var eTop, eLeft, myTarget; //page variables
var i=0; //page variables

function getPos(e)
{
if (!e) {e = window.event;}
else {myTarget = e.srcElement;}
eTop = myTarget.offsetTop + 120;
eLeft = myTarget.offsetLeft;
}

var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)

document.onmousemove = getMouseXY;
document.onmousedown = getMouseXY;

var tempX = 0
var tempY = 0

function getMouseXY(e)
{
if (IE)
{
tempX = event.clientX + document.body.scrollLeft
tempY = event.clientY + document.body.scrollTop
}
else
{
tempX = e.pageX
tempY = e.pageY
}

if (tempX < 0){tempX = 0}
if (tempY < 0){tempY = 0}
return true
}

]]>
</script>
</xsl:template>

<xsl:template match="adminright">
<tr>
<xsl:attribute name="onclick">
getPos(event);
with (document.getElementById("adminRight"))
{
style.Top=eTop;
style.width="630px";
style.position='absolute';
style.background='#FFF';
style.display='block';
}
</xsl:attribute>
</tr>
 
G

Guest

Thanks for the reply. I did that and it still doesn't move the <DIV> to
the row where the mouse is clicked.
 
M

Martin Honnen

nospam said:
I did that and it still doesn't move the <DIV> to
the row where the mouse is clicked.

Show us the relevant HTML and script and perhaps we can help further but
get rid of the XSLT before posting the code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top