Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript not working correctly in Firefox

    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:

    PHP Code:
    function fnReset(){
        
    document.getElementById('dTorso').style.height="380px";
        
    document.getElementById('dMiddle').style.height="auto";
        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:

    Code:
    <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.

    Thanks!

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Quote Originally Posted by ambiemaber View Post
    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.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    Here is one of my pages:

    removed url

    The bottom div (dfooter) in Firefox, does not resize to go underneath the dmiddle
    Last edited by venegal; 10-21-2011 at 12:08 AM. Reason: removed url

  • #4
    Gütkodierer
    Join Date
    Apr 2009
    Posts
    2,127
    Thanks
    1
    Thanked 426 Times in 424 Posts
    You should start by fixing your Javascript errors.

    I'm getting "Cannot set property 'innerHTML' of undefined" for this line of code:
    PHP Code:
    this.container.innerHTML=this.formatresults(dayfieldhourfieldminutefieldsecondfield
    Use the debugging tools of your browser to see those errors.
    .My new Javascript tutorial site: http://reallifejs.com/
    .Latest article: Calculators — Tiny jQuery calculator, Full-fledged OOP calculator, Big number calculator
    .Latest quick-bit: Including jQuery — Environment-aware minification and CDNs with local fallback

  • #5
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #6
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi!

    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •