File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes DIV Popup Location Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "DIV Popup Location" Watch "DIV Popup Location" New topic
Author

DIV Popup Location

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1490
    
    1
I am trying to use the suggestions I got from this forum concerning DIV tags. I have a main layout page in which I place some static DIV's to hold JSP's. I also have several DIV's I am using as popups to promt and or display specific info when a user clicks different links and form controls.

My question is what is the best way to position these popups in a particular location? I know how to set the x any y positions of the DIV but figuring out the values that x and y needs to be is my challenge. In my past windows development I placed an invisible control on the form where I desired then when positioning dynamic controls I would reference the top and left properties of the invisible control. Not sure how to do that on a web page.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61760
    
  67

Where do you want to put it?

If you know the co-ords, then I'm not sure what the question is.

If you want it relative to a mouse event like a click, the location of the event is available in the Event instance.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1490
    
    1
Bear Bibeault wrote:Where do you want to put it?

If you know the co-ords, then I'm not sure what the question is.

If you want it relative to a mouse event like a click, the location of the event is available in the Event instance.


In some cases I have the DIV poping up at the mouse location but this is not practical for ever case.

Say I have a text box that shows a drawing number it is in a JSP location in one of my statis DIV's. Now the user clicks on a link to show the release history of this drawing number. I would like the DIV to popup just under the textbox of the drawing number. Again I can set the x and y of the DIV but what is the best way to know where the co-ords of the drawing number text box is?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61760
    
  67

Are you a jQuery user? If so, use it.

If not, you will have a lot of fun trying to figure it out in a browser-independent fashion (in other words, not too easily).
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1490
    
    1
Bear Bibeault wrote:Are you a jQuery user? If so, use it.



How do I use jQuery to get the position of my static textbox location?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61760
    
  67

offset()
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DIV Popup Location