Getting 2 div's to match height.
|
| View previous topic :: View next topic |
| Author |
Message |
jatrant
Joined: 25 Jun 2008 Posts: 1
|
Posted: Wed Jun 25, 2008 10:25 pm Post subject: Getting 2 div's to match height. |
|
|
Ok so after a day of doing research I have found great resources for very similar scripts but not exactly what i need. I need a script that will grab height of one SPECIFIC div and then apply it to another SPECIFIC div. The resources I have found have been match height of maximum div height overall.
I have been trying to play with a script i grabbed online but what i dont know what to do is point to the Specific Div i need....
| Code: |
<script language="javascript">
dynheight=function(){
var divs,contDivs,maxHeight,divHeight,d,div2;
divs=document.getElementsByTagName('mycontent');
contDivs=[];
for(var i=0;i<divs.length;i++){
if(/\bcontainer\b/.test(divs[i].className)){
d=divs[i];
contDivs[contDivs.length]=d;
// determine height for <div> element
if(d.offsetHeight){
divHeight=d.offsetHeight;
}
else if(d.style.pixelHeight){
divHeight=d.style.pixelHeight;
}
}
div2=document.getElementsByTagName('layer2');
div2.style.height=divHeight;
window.onload=function(){
if(document.getElementsByTagName){
dynheight();
}
}
</script> |
What i ultimately need it to do is look for the height for <div id="mycontent"> and apply the same height to <div id="layer2">.
I'm afraid no other work around will work for what i need, so I'm wondering if someone can help to get this script working.
Thanx |
|
| Back to top |
|
 |
|
|
rangana 500+ Club

Joined: 27 Feb 2008 Posts: 629 Location: Cebu City Philippines
|
Posted: Thu Jun 26, 2008 1:30 am Post subject: Re: Getting 2 div's to match height. |
|
|
First, language is a deprecated attribute. Use type instead.
Secondly, show us your markups. We can't figure what's wrong. |
|
| Back to top |
|
 |
|
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums. Click here to Register
If you are a current member here on DEVPPL, please login below:
|
|
|
|