wood burning stoves*
The moose likes HTML, CSS and JavaScript and the fly likes Div overlapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Div overlapping" Watch "Div overlapping" New topic
Author

Div overlapping

Ashutosh Arya
Ranch Hand

Joined: Oct 07, 2008
Posts: 69
Hi,

I am using AJAX in my application at various places and using div's to show the response.

Now a days I have seen at many places that the AJAX responses overlap other elements of the JSP

Eg: If I am making a table and i need to show it other elements.

Don't know how to do it? (Have tried with z index but it dint worked out!)

My code is like this:

<input type="text" name="Division1" id="divisionVal" onkeyup="autoComplete(this.value,event);"/> <div id="txtSuggestions"></div>

Th response is sitting in <div id="txtSuggestions"></div>

Please suggest how can I make it overlap other elements?

Thanks in advance!

Aashu
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

Please take the time to choose the correct forum for your posts. This forum is for questions on JSP. For more information, please read this.

This post has been moved to a more appropriate forum.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

This has noting to do with Ajax. You can layer a <div> element over the others with a combination of z-index and CSS positioning.
Ashutosh Arya
Ranch Hand

Joined: Oct 07, 2008
Posts: 69
Hi Bear,

I tried that but it was not working.

Can you please suggest an online resource where I can learn more about that?

Thanks

Aashu
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

ItDoesntWorkIsUseless

What did you try and how did it not work?
Ashutosh Arya
Ranch Hand

Joined: Oct 07, 2008
Posts: 69
I tried:

<div id="txtSuggestions" style="z-index: 100"></div>

and gave z-index lesser than 100 to all other elements!

Is there anything wrong I am doing...yes surely something is wrong but what I am unable to find out!

Aashu
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Are you positioning it? Does not look like you are. Look at CSS Position
Ashutosh Arya
Ranch Hand

Joined: Oct 07, 2008
Posts: 69
Thanks to you all!

Got the result by using the below CSS:

.overlap {
position: absolute;
z-index:1002;
overflow: auto;
}

Aashu
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Div overlapping