HTML
  Home arrow HTML arrow Page 3 - The Ins and Outs of Iframes
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

The Ins and Outs of Iframes
By: John Best
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-12-15

    Table of Contents:
  • The Ins and Outs of Iframes
  • iframes Questions and Answers
  • Uses of iframes
  • iframe Uses continued

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The Ins and Outs of Iframes - Uses of iframes


    (Page 3 of 4 )

    The simplest use of an iframe is to merely display a static page located on the same server, for example:

    <iframe src ="/path/mypage.html" width="100%"></iframe>

    Not too exciting, right? Well, let's learn about some more interesting uses. To aid the discussion, we will talk about the web site of the fan club for the Webtown Wizards, my buddy Joe's favorite football club (it is imaginary, and so is Joe).

    Joe is the webmaster of the Wizards Fans website, and he wanted to add something to make the blog page more interesting, so he added an iframe containing the home page of somesportsite.com (imaginary, I think). The somesportsite.com page had a score box so the fans could check out the score of the game while they write messages on the blog. The score box was the only area of the page that they were actually interested in.

    <iframe src ="http://www.somesportsite.com" width="100%"></iframe>

    This was a nice addition, but it was inconvenient to use. There was only room on the Wizards blog page for a 500px by 300px iframe, but somesportsite.com was a full-size web page. This meant that the iframe had scrollbars, and since the score box was located near the middle of the somesportsite.com page, a lot of scrolling was required to reach it. What Joe really wanted was to have only the score box from the somesportsite.com page display in the iframe. This is how he achieved it.

    Displaying an Area of a Page in an iframe

    The first thing Joe did was create a page called iframedemo.html. He then placed the iframe tag on the page. He made sure that it had a name attribute, knowing he would need it.

    <iframe name="scorebox" src="http://dummypage.html" width="500" height="300" frameborder="0" scrolling="no" marginwidth="0" marginheight="0">

    </iframe>

    Making the iframe the same size as the score box (500 x 300), was easy using the width and height attributes. The problem Joe needed to overcome was that the iframe displayed the upper-left corner of the somesportsite.com page by default, but the score box was in the middle of the page. How could he move the area displayed by the iframe down to where the score box was?

    What he did to solve this problem could more accurately be thought of as moving the somesportsite.com page underneath the area displayed in the iframe until the score box is visible.

    More HTML Articles
    More By John Best


       · http://vur.me/lex/acne/See the link above.The iframe resizes.
     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek