HTML
  Home arrow HTML arrow Page 5 - The power of DIV with IFRAME
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 
Sun Developer Network 
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 power of DIV with IFRAME
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 30
    2006-03-08

    Table of Contents:
  • The power of DIV with IFRAME
  • Using a DIV as variable to write into IFRAME: discussion
  • Making DIV more dynamic to write into IFRAME
  • Creating your own library to write dynamic content to IFRAME: essentials
  • Creating your own library to write dynamic content to IFRAME: utility functions

  • 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 power of DIV with IFRAME - Creating your own library to write dynamic content to IFRAME: utility functions


    (Page 5 of 5 )

    The following function may be used to resize the IFRAME dynamically.

    IFrameBox.prototype.Resize = function(wdth)
    {
          if( IFrameBox.IsBrowserIE() )
          {
                var div = frames[this.id].document.getElementById(this.DivID);
                if(!wdth)
                      this.IFrame.style.width = div.offsetWidth;
                else
                      this.IFrame.style.width = wdth;
                this.IFrame.style.height = div.offsetHeight;
          }
          else
          {
                this.IFrame.style.width = this.Width;
                this.IFrame.style.height = this.Height;
          }
    }

    The following function may be used to place an IFRAME at required positions on the web page:

    IFrameBox.prototype.PlaceAt = function(x, y)
    {
                this.IFrame.style.position = "absolute";
                this.IFrame.style.left = x;
                this.IFrame.style.top = y;
    }

    The following function tests whether the current IFRAME is in the visible state or not:

    IFrameBox.prototype.IsVisible = function()
    {
          var ifrm = document.getElementById(this.id);     

          if( ifrm.style.visibility == "visible" && ifrm.style.width > 0 )
                return true;
          else
                return false;
    }

    The following function makes an IFRAME visible (make sure that it uses some of the functions defined above).

    IFrameBox.prototype.Show = function(evt, msg, wdth)
    {
          if( this.IsVisible() )
                return;                

          var div = frames[this.id].document.getElementById(this.DivID);
          div.innerHTML=msg;
          this.Resize(wdth);     

          if(evt)
          {
                this.PlaceAt((evt.x +10),(evt.y +10));
          }           

               

          this.IFrame.style.visibility = "visible";
          this.IFrame.style.zIndex = "999999";
    }

    Hiding an IFRAME is the simplest of all. You can define the function as follows:

    IFrameBox.prototype.Hide = function()
    {     
          this.IFrame.style.visibility = "hidden";
          this.IFrame.style.width = 0;
          this.IFrame.style.height = 0;
    }

    I leave it to the programmers to further extend the library to suit their needs.  The above set of functions is very suitable for presenting eye-catching tool tips on your web page.  As the tool tips are based on IFRAME, they are naturally displayed ahead of any windowed controls (like dropdown lists and so on).

    Any comments, suggestions, ideas, improvements, bugs, errors, feedback etc. are highly appreciated at jag_chat@yahoo.com.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Hello guys! A fine introduction on using DIV with IFRAME. enjoy and give any...
       · I tried this tutorial but it didn't work in firefox. what are the firefox work...
       · I tried this tutorial but it didn't work in firefox 3.0. what are the firefox work...
     

    HTML ARTICLES

    - Using a 3D HTML Table as a Recordset
    - Building a 3D HTML Table
    - Maximizing and Restoring HTML Images: Layer ...
    - Completing Construction of a Database Form w...
    - Maximizing and Restoring Images in a Tabular...
    - Building the Recordset for an HTML Database ...
    - Laying Out a Database Form with HTML
    - Tabular Database Form Functions with HTML
    - Tabular Database Forms with HTML
    - Using the Find Functions for HTML Database F...
    - Sorting for Database Forms with HTML
    - Edit and Other Database Form Functions with ...
    - More Database Form Functions with HTML
    - Database Form Functions with HTML
    - Using the HTML Table Element as a Recordset






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT