Rip on your code? Why, looks good, it works, ship it! □ Looks like it annoys other people too.Īnyway, feel free to rip on my code in the comments, but I was looking for a simple, working example of setting an iframe’s height so that the iframe wouldn’t have a scrollbar. It always annoys me to dive into cross-browser development when it feels like things should be standardized. The net effect is that IE will show a scrollbar unless you add “frameborder=0”. If you leave off the frameborder attribute, Internet Explorer will assume that the frame should have a nonzero border, but it won’t include the frame border in the value it returns for scrollHeight. The only tricky bit is the “frameborder=0 border=0” attributes on the frame. The function sets the height of the frame to be the scrollHeight, which effectively removes the scrollbar. Then the page calls a function resizeFrame(). What does this code do? When the body of the parent frame loads, it looks up the document element “childframe” which corresponds to the iframe. You can also see a live example of resizing an iframe height dynamically. Internet Explorer shows scrollbar because of frameborderį.style.height = f. + “px” Now in the parent frame, you can make code like this: I made a file “child-frame.html” that looks like this: First, make the iframe that you want to include. That is, you want something that looks like this: You’d like to resize the height of the child iframe so that it doesn’t show a scrollbar. Suppose you want to include a child iframe on your page.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |