Solved

overwriting of <div>

Posted on 2011-09-18
21
242 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 10
21 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 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:gurvinder372
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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:gurvinder372
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:gurvinder372
ID: 36558399
Yes
0
 

Author Comment

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

Expert Comment

by:gurvinder372
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:gurvinder372
ID: 36558863
please explain the parameters of this method
0
 
LVL 40

Expert Comment

by:gurvinder372
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:gurvinder372
gurvinder372 earned 500 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:gurvinder372
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:gurvinder372
ID: 36559027
how should i login? i don't see the link to login
0
 
LVL 40

Expert Comment

by:gurvinder372
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

688 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