Solved

overwriting of <div>

Posted on 2011-09-18
21
240 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:
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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
push Book Today button to right 10 36
Problem to refer to value 8 62
Just need a little help with this header height please 10 44
..ignore the Question 1 7
This article discusses how to create an extensible mechanism for linked drop downs.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

860 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