PDA

View Full Version : Javascript window.onload()



happy123
09-19-2006, 02:52 PM
Hi. I am using javascript with window.onload() which Safari is not handling correctly. I'm new to coding to handle mac issues. Does anyone have a workaround. Code below ...

matchColumns=function(){

var divs,contDivs,maxHeight,divHeight,d;
divs=document.getElementsByTagName('div');
contDivs=[];
maximumHeight=0;

for(var i=0;i<divs.length;i++){

if((divs[i].id=="grouping")||(divs[i].id=="textbar")||(divs[i].id=="ads")||(divs[i].id=="content"))
{
d=divs[i];
contDivs[contDivs.length]=d;

if(d.offsetHeight)
{
divHeight=d.offsetHeight;
}
else if(d.style.pixelHeight)
{
divHeight=d.style.pixelHeight;
}
maximumHeight=Math.max(maximumHeight,divHeight);
}
}
contDivs[0].style.height=(maximumHeight + 20) + "px";
contDivs[1].style.height=(maximumHeight-10) + "px";
contDivs[2].style.height=maximumHeight + "px";
contDivs[3].style.height=(maximumHeight-20) + "px";
}


window.onload=function()
{
if(document.getElementsByTagName){
matchColumns();
}
}