473,322 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

reposition DIV element

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>
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #1
3 4721


nospam wrote:
getPos(event);
with (document.getElementById("adminRight"))
{
style.Top=eTop;


Try
style.top = eTop + 'px';

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Thanks for the reply. I did that and it still doesn't move the <DIV> to
the row where the mouse is clicked.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3


nospam wrote:
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.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Igor | last post by:
Is there any way to resort and xml document using xslt based on element position. For example if I have xml like this: <root> <element> 1st thing </element> <element> 2nd thing </element>...
6
by: Luke Dalessandro | last post by:
I'm not sure if this is the correct forum for platform specific (Mozilla/Firefox) javascript problems, so just shout and point me to the correct newsgroup if I'm being bad. Here's the deal... ...
2
by: Buddy | last post by:
Hello, Can someone point me to some example code that shows how to paint the text in a button control. I basically want to reposition the text so it does not wrap.
2
by: Garibaldi | last post by:
Thanks to all... I need to read a block of text, operate on the read text then move to the next text block and so on and so on from a 650MB file. Pseudo code would be something like this: ...
5
by: ukrbend | last post by:
I'm trying to create a link to a certain part of a page on another website that has no anchor (i.e. ID or name) at the position on the page I want to link to. So I can't do something like ...
3
by: Lee | last post by:
Hello, I am trying to reposition a calendar control at runtime i.e next to the approriate button which was clicked. Without the code below, the control appears in the same position but on top...
4
by: patrizio.trinchini | last post by:
Hi all, I'm new to XSLT and maybe my problem have a very trivial answer, but I need an expert that point me in the right direction. What I would obtain is to remove all the elements that have a...
0
by: ChuckMac | last post by:
I have text fields with a matching search button, that get search information keyed in a field then the search button (for that text item) is pressed which caused a database search to take place. The...
2
by: mlb5000 | last post by:
I seem to be having issues validating an XML document using my schema. Both are below: The Schema: <?xml version="1.0" encoding="UTF-8"?> <xs:schema...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.