JavaScript
  Home arrow JavaScript arrow Page 4 - Working with IFRAME in JavaScript
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? 
JAVASCRIPT

Working with IFRAME in JavaScript
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 94
    2006-03-01

    Table of Contents:
  • Working with IFRAME in JavaScript
  • How to open a dynamic page in IFRAME using JavaScript
  • How to open a dynamic page in IFRAME using JavaScript: discussion
  • How to write content dynamically into IFRAME using JavaScript
  • How to write content dynamically into IFRAME using JavaScript: discussion
  • How to write content dynamically into IFRAME using JavaScript: another way

  • 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


    Working with IFRAME in JavaScript - How to write content dynamically into IFRAME using JavaScript


    (Page 4 of 6 )

    As you are now familiar with IFRAME (from reading the previous sections), I shall further proceed with another interesting ability: writing dynamically to IFRAME.  This has been a tedious job for any beginner who wanted to do it using JavaScript.

    Now, let us try to develop a simple script (JavaScript) which shows a user specified message in an IFRAME. Have a look at the following code:

    <html>
          <head>
                <meta  name=vs_targetSchema  content="http://schemas.microsoft.com/intellisense/ie5">
    <script  id="clientEventHandlersJS"  language="javascript">
    <!--
    function Show(val)
    {
            var testFrame = document.getElementById("myFrame");
            var doc = testFrame.contentDocument;
            if (doc == undefined || doc == null)
                doc = testFrame.contentWindow.document;
            doc.open();
            doc.write(val);
            doc.close();       

          document.all.myFrame.style.visibility="visible";
    }

    function ButtonShowMsg_onclick() {
    var v = document.all("txtContent").value;
    Show(v);
    }
    //-->
                </script>
          </head>
          <body>
          <iframe  id="myFrame"  frameborder="0"  vspace="0"  hspace="0" marginwidth="0"
    marginheight="0"  width="100"  scrolling=yes  height="100"
    style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; Z-INDEX: 999; LEFT: 20px; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid; POSITION: absolute; TOP: 100px; visibility:hidden;"></iframe>

                <form  id="form1">
                      Enter content:<input  type="text"  id="txtContent"  NAME="txtContent"  value="This is going to be sample content in IFRAME"> <input  type="button"  value="Show"  id="Button1"  name="ButtonShowMsg"  onclick="return ButtonShowMsg_onclick()">
                </form>
          </body>
    </html>

    The explanation for the above code is given in the next section.

    More JavaScript Articles
    More By Jagadish Chaterjee


       · Hai, want to work with IFRAME? here is a simple article on that. any doubts you...
       · Hello ,I am Riddhi Bhavsar.I am a Web Developer.And I am a beginner for...
       · how can i write content to the iframe if it has an src valuelike <iframe...
     

    JAVASCRIPT ARTICLES

    - More on JavaScript Array Objects
    - Methods of the DOM Location Object
    - The DOM Location Object Properties
    - Handling Remote Files with JavaScript Click ...
    - Using Click Interceptions with a Database-Dr...
    - Using JavaScript Click Interceptions in an I...
    - Using Click Interceptions with JavaScript
    - QuickSort in Action
    - Quicksort
    - Using Mod_Security to Protect Your Server
    - Detecting and Countering Server Intrusions
    - Securing Your Web Server
    - Building a Secure Web Server
    - Protecting the Server
    - Book Review: Learning the Yahoo! User Interf...


     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     





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