Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Getting 2 div's to match height.



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
jatrant



Joined: 25 Jun 2008
Posts: 1

PostPosted: Wed Jun 25, 2008 10:25 pm    Post subject: Getting 2 div's to match height. Reply with quote

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
View user's profile Send private message
rangana
500+ Club


Joined: 27 Feb 2008
Posts: 629
Location: Cebu City Philippines

PostPosted: Thu Jun 26, 2008 1:30 am    Post subject: Re: Getting 2 div's to match height. Reply with quote

First, language is a deprecated attribute. Use type instead.
Secondly, show us your markups. We can't figure what's wrong.
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
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:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap