0

I have this function:

function adjust_height () {
    document.getElementById('left').style.height = document.getElementById('center').style.height;
    document.getElementById('right').style.height = document.getElementById('center').style.height;
}

I want to know the syntax for doing this. Thanks in advance.

Faito
  • 783
  • 1
  • 5
  • 18

1 Answers1

0

Thanks to everyone who answered, this is the working result =).

function adjust_height () {

    var center = document.getElementById('center') ;
    var left = document.getElementById('left') ;
    var right = document.getElementById('right') ;

    left.style.height = center.clientHeight + 'px';
    right.style.height = center.clientHeight + 'px';
}

style.height only has a value if the element has fixed height declared in the .css file, so you can't get the height that way if you are working with liquid elements!!.

Then you just have to call the function, i needed it on the body load, like this:

< body onload="adjust_height()">

Hope this helps, cheers! =).

Faito
  • 783
  • 1
  • 5
  • 18