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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What's wrong with this code?

    Hi,
    I've got an html page that has it's overflow hidden with integrated css, now I want to use javascript to set overflow to hidden as soon as an swf is finished.

    My code is


    function hidelayer(lay) {
    document.getElementByName('body').style.overflow = 'visible';
    }


    and I'm calling this function from flash with: getURL("javascript:hidelayer('newlayer');"); in the last frame.

    But the overflow stays hidden, so apparantly my javascript is wrong.
    The overflow is set to hidden in the body tag btw.

    Can anyone help me?

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,733
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    You should enclose the part of the page which you wish to hide in a <div>
    and then use

    document.getElementById("divName").style.display="block";
    or
    document.getElementById("divName!).style.display="none";

    You say that the overflow is set to hidden in the body tag btw.

    In which case you should perhaps use

    document.getElementById("divName").style.visibility = "visible";
    or
    document.getElementById("divName").style.visibility = "hidden";


    NOTE: visibility:hidden hides an element, but it will still take up the same space as before.
    display:none hides an element, and it will not take up any space.

    There is no such thing as getElementByName.
    getElementsByName returns an array collection of HTML elements of specified name.

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
    Last edited by Philip M; 11-12-2010 at 03:59 PM.

  • #3
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thnx for the reply philip,

    The code that hides the div allready works, the only part left is that I want the user to have a scrollbarr again as soon as the div gets hidden.

    I found out about the elements error btw, I currently using this code:

    document.getElementsByName('body')[0].style.overflowY = 'visible';

    but it's still not working =(


  •  

    Posting Permissions

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