View Full Version : Javascript not working correctly in Firefox

10-11-2011, 04:02 AM
Hi There,

I have recently completed making a website for my sister's wedding. I am quite new to the web design world, and have only taken 2 classes on the subject. I used a Javascript function that was provided to us in one of my HTML coding classes in order to automatically resize the (nesting?) div's according to how long the content in them is.

This all seems to work perfectly fine in Google Chrome, as well as most versions of Internet Explorer - however, in some versions of internet explorer, and ALL versions of Firefox, this resize function does not seem to work. Since this coding was provided to me by a teacher (who is unfortunately in another country), I'm not sure what kinda of edit would make it so it would function in Firefox, or if there is a way to make in function in Firefox at all.

I would appreciate if some of you could take a look at it, and let me know if you have any ideas/suggestions/advice, as to what is happening with the code/why it does not work in Firefox/some versions of Internet Explorer.

The specific javascript code (which i assume is the issue here - please let me know if I'm wrong about it being the javascript that isn't working) is here:

function fnReset(){
var middleHt=document.getElementById('dMiddle').scrollHeight;
var maxHt=Math.max(380,middleHt);
document.getElementById('dTorso').style.height=maxHt + "px";
document.getElementById('dMiddle').style.height=maxHt + "px";

Which is then called to action here:

<body onLoad="fnReset();>

Also, in some versions of Firefox, the background image for the whole page isn't showing up either - any tips on why that is happening would also be amazing.

Thank you so much for any help you may provide. This is a gift to my sister and her fiance, and I really want it to work well for them, and all their guests.


10-11-2011, 10:14 AM
in order to automatically resize the (nesting?) div's according to how long the content in them is.
I don't understand... a DIV will always resize in height, by default, according to its content. I don't understand why do you need a javascript function for that.

Can you post a link to a test page? I suspect you have more CSS constrains.

10-11-2011, 03:05 PM

Here is one of my pages:

removed url

The bottom div (dfooter) in Firefox, does not resize to go underneath the dmiddle

10-11-2011, 06:30 PM
You should start by fixing your Javascript errors.

I'm getting "Cannot set property 'innerHTML' of undefined" for this line of code:

this.container.innerHTML=this.formatresults(dayfield, hourfield, minutefield, secondfield)

Use the debugging tools of your browser to see those errors.

10-11-2011, 06:48 PM
I got everything working by just adjusting the heights I used in the Javascript. It's probably not the correct way to fix what was happening, but it is working enough that people will be able to read the screen, and that's the important thing to me, haha.

Thanks for your help :)

10-20-2011, 10:49 PM

I have got everythign on my site working now. But when I do a search for it in Yahoo, this page keeps turning up in the search results. Would it be possible for a mod to please remove the web address for the page in my 2nd post so this doesn't happen anymore?

Thanks :)