Grow your CSS skills. Land your dream job.

Scrolling, Frameborder, and Allowtransparency Attributes in IE.

  • # May 10, 2011 at 4:49 pm

    I am working on a website here. I am using iframes for the navbar and footer. Because of IE 8 and older I must set the following attributes on the iframes: allowtransparency=”true”, frameborder=”0″, and scrolling=”no”. None of these will validate, so therefore I am using JavaScript to set these attributes using the following code:


    onload = function()
    {
    var theframes = document.getElementsByTagName( 'iframe' );
    for( var i = 0; i < theframes.length; i++ )
    {
    theframes.setAttribute( "frameborder", "0" );
    }
    for( var i = 0; i < theframes.length; i++ )
    {
    theframes
    .setAttribute( "allowTransparency", "true" );
    }
    for( var i = 0; i < theframes.length; i++ )
    {
    theframes
    .setAttribute( "scrolling", "no" );
    }
    }

    I have also tried this:


    onload = function()
    {
    var theframes = document.getElementsByTagName( 'iframe' );
    for( var i = 0; i < theframes.length; i++ )
    {
    theframes.setAttribute( "frameborder", "0" );
    theframes
    .setAttribute( "allowTransparency", "true" );
    theframes
    .setAttribute( "scrolling", "no" );
    }
    }

    Both of these only the allowtransparency works. I am still a novice to Javascript and any help would be appreciated.
    The page using this code can be found here. (Note that this is the 404 error page.)
    -Cliff

    # May 11, 2011 at 2:05 am

    it could be iframe browser security issue, you cannot set some attributes via javascript on iframes.

    # May 11, 2011 at 8:21 am

    Hmmm… interesting. Do you know which attributes are not settable via javascript, and why?
    Thanks,
    Cliff

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".