Forum Moderators: not2easy

Message Too Old, No Replies

Can variables be used as property values in-line

         

stylenewbie

6:20 am on Nov 5, 2004 (gmt 0)

10+ Year Member


Hi All,

I use a table and javascript to operate a kind of spreadsheet which could be 100 or more rows. For specific cells I need to popup a div with a message and additional user input. I need the div to be positioned within a few pixels horizontally of the cell that was clicked by the user.

I capture a vertical position of the click in a javascript variable 'vert' and need the inline <DIV> style to pay attention to style=
"position:absolute;top:vert".

That doesn't want to cooperate. Can anyone suggest an alternative.

Thanks in advance for helping out a newbie.

Lance

2:31 pm on Nov 5, 2004 (gmt 0)

10+ Year Member



POSITION: absolute; uses the coordinates of a positiond parent as it's 0,0 reference point. If there is none, then it uses the <body> as it's reference point. So, if you apply POSITION; relative; (but with no offests) to each cell, the refernce point for your inline div becomes the cell itself.

If you give the div:
POSITION: absolute;
TOP: 10px;
for example, your <div> will be positioned 10px below the top of the cell regardless of where the cell is. But again, the cell itself must have POSITION: relative applied to it for this to work.

Hope this helps.

stylenewbie

1:10 am on Nov 6, 2004 (gmt 0)

10+ Year Member



Lance.. thanks so much, your advice was right on the money.

Lance

1:23 am on Nov 6, 2004 (gmt 0)

10+ Year Member



Glad I could help, and...

Welcome to Webmaster World, if you haven't already been told.