I have a page that I don't control the source to. It contains an iframe. The iframe has scrollbars and a border. I want to remove both. I tried using Jquery like this:
开发者_C百科$('iframe').attr('scrolling', 'no');
Nothing I do will affect the iframes attributes at all.
Any ideas? (IE8)
http://www.w3.org/TR/html4/present/frames.html#h-16.5
<iframe scrolling="no" frameborder="0">
You can access the iframe's attributes using jQuery, and simply set the scrolling to "no" like this:
$("#frame")[0].setAttribute("scrolling", "no");
Just be sure to append the [0] as above, so the jQuery object will return the first DOM element.
frameborder="0"
I believe for the border part. You could play around with css overflow for the scrolling, not exactly sure about that.
Try this.
$("iframe").each(
function(index, elem) {
elem.setAttribute("scrolling","no");
}
);
I didn't test it but it should work.
精彩评论