• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Javascript to find pixels from left for a text?

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
The problem is:My menus dropdown list is depending on the browser, screen solution and also if the window is maximized or not.
Will therefore try to find out which position(from left and from top) some text from tables inside my window has, and then just adjust my dropdown list after that. By setting:
style.left &
style.top.
1. Which code do I use to find the left and top position of some text thats already in the page?
This is the text:
<td width="125" align="center"><a href="#" onMouseClick="findLeftAndTopPosition()">***TextToFindPositionFor**</a></td>
yours Age

--------------------------------------------------------------------------------
Posts: 15 | Registered: Aug 2002 | IP: Logged

Bear Bibeault
ranch hand
Member # 24697
posted November 08, 2002 12:50 PM
--------------------------------------------------------------------------------
Certainly not a JSP question, so I expect this shold be moved to the HTML forum.
In anticipation of that, why do you want to do such a thing rather than relying on the usual CCS2 positioning mechanisms? What are you really trying to accomplish?
bear

--------------------------------------------------------------------------------
Posts: 381 | Registered: Jan 2002 | IP: Logged

age spets
greenhorn
Member # 34438
posted November 11, 2002 01:40 AM
--------------------------------------------------------------------------------
The reason why I posted it here is simply since I am using it in a jsp file. But I will post it under the javascript section... Didnt know it was there..
The reason why I have to solve the problem in this way, is that the css left margin will change depending on the screen size, navigator they use and the maximize/minimize of the window. Therefore I need some javascript to set the left margin depending on other text in the window.
 
age spets
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
MORE INFO:
Can`t use the position relative, must use absolute. Thats what makes this problem too...
 
age spets
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Solved the problem!
The reason why I was struggling with the absolute position was that I had set the left and top position. If I removed this, it was working independent on screen size and maximize/minimize.
Hope this can help someone else with the same problem:-)
reply
    Bookmark Topic Watch Topic
  • New Topic