View Full Version : What's wrong with this code?

11-12-2010, 03:47 PM
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?

Philip M
11-12-2010, 04:52 PM
You should enclose the part of the page which you wish to hide in a <div>
and then use


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";
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.

11-12-2010, 05:17 PM
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 =(