?
Solved

overwriting of <div>

Posted on 2011-09-18
21
Medium Priority
?
251 Views
Last Modified: 2012-05-12
i have two <div> tags on same position . how to assign z-index to them so that when i click on one div tag so that one become enable and become disabled......


Thanx in advance
0
Comment
Question by:savsoft
  • 11
  • 10
21 Comments
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 2000 total points
ID: 36558290
only way to disable a div, as far as i know, is by overlaying another div on top of it with higher z-index

<div id="divToBeOverlayed"></div>

<div id="divThatOverlays"></div>

#divToBeOverlayed
{
  position:absolute;
  top:100px;
  left:100px;
  height:100px;
  width:100px;
  z-index:1;
}

#divThatOverlays
{
  position:absolute;
  top:100px;
  left:100px;
  height:100px;
  width:100px;
  z-index:3;
}

since the z-index of the divThatOverlays is higher, it will come on top and divToBeOverlayed will look like disabled
0
 

Author Comment

by:savsoft
ID: 36558318
can we use z-index for <td> tag also.....???? because one div is overlaying another <td>
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36558325
Yes, it can be used for any element as long as you have positioned that element.
http://www.w3schools.com/cssref/pr_pos_z-index.asp

you need to give position:relative for that td
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:savsoft
ID: 36558371
One more thing gurvinder....is there any way that if one div is there of index 2 and one of index 3....when idiv with index 2 is hidden then index of div 3 get enabled automatically
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36558385
i guess, even if the div with z-index 2 is not hidden, div with z-index 3 will always be enabled regardless, since it will be on top of div with index 2.
Higher index takes more priority and it overlays whatever is beneath with lower z-index
0
 

Author Comment

by:savsoft
ID: 36558395
and if index 3 div is hidden.....will the div with index 2 will be enabled automatically
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36558399
Yes
0
 

Author Comment

by:savsoft
ID: 36558404
shukriya.....:P:P
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36558418
Glad to help. Please respond to your other open questions as well
0
 

Author Comment

by:savsoft
ID: 36558684
i want to hide second div whose z-index:2 and enable to first div whose z-index:1  by calling function

function hidestuff(id,toph,main)
{
document.getElementById(main).style.border="none";
document.getElementById(id).style.display="none";
}

it hide second div but doesn't enable first div


0
 

Author Comment

by:savsoft
ID: 36558697
thanks in advance
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36558863
please explain the parameters of this method
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36558882
which one is div with index 1 and which one is div with index 2
0
 

Author Comment

by:savsoft
ID: 36558905
i have two div

one with index 1 and one with index 2........ when i click on one link then i want ke zindex get replaced that is the procedure i want...... so plz explain me with short example
0
 
LVL 40

Assisted Solution

by:Gurvinder Pal Singh
Gurvinder Pal Singh earned 2000 total points
ID: 36558914
function replaceZIndex(divId1, divId2)
{
   var divId1ZIndex = document.getElementById(divId1).style.zIndex;
 
   document.getElementById(divId1).style.zIndex = document.getElementById(divId2).style.zIndex;

   document.getElementById(divId2).style.zIndex = divId1ZIndex ;
}

0
 

Author Comment

by:savsoft
ID: 36558981
i am not able to solve problem its just like facebook chat ....when chat window get opens then area behind that window become absolute
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36558984
is it possible for you to share live internet link
0
 

Author Comment

by:savsoft
ID: 36559019
www.labbo22.com

username is : contacts@savsoft.co.in
password is sasasa...come there i ll tell you what i want
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36559027
how should i login? i don't see the link to login
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36559029
i am able to login, but it says unable to post
0
 

Author Comment

by:savsoft
ID: 36559035
ya plz login there again.....actually i have unblocked you... because we were testing so come back..thr?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question