displaying HTML code in frame?


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: displaying HTML code in frame?

  1. #1
    mat311275 Guest

    displaying HTML code in frame?


    Does anyone know a way of displaying the HTML code from one frame in another,
    complete with tags?
    I've been trying document.write, and pre /pre tags, but the browser still
    seems to be trying to interpret the tags in what I want to be plain text.
    Can it be done?

  2. #2
    Frederiek Guest

    Re: displaying HTML code in frame?


    Try with <xmp>the html code</xmp>, or convert "<" and ">" to respectively
    "&lt;" and "&gt;".

    cya
    Frederiek


    "mat311275" <mat.j@excite.co.uk> wrote:
    >
    >Does anyone know a way of displaying the HTML code from one frame in another,
    >complete with tags?
    >I've been trying document.write, and pre /pre tags, but the browser still
    >seems to be trying to interpret the tags in what I want to be plain text.
    >Can it be done?



  3. #3
    Russell Jones Guest

    Re: displaying HTML code in frame?

    In IE, place a <div> tag in the target frame and set its innerText property
    to the innerHTML property of the body tag from the source frame. Here's an
    example. It doesn't use frames, but the concept is identical.

    <HTML>
    <HEAD>
    <TITLE></TITLE>
    </HEAD>
    <BODY>

    <input type="button" value="Move HTML" onclick="moveHTML();"><br>
    <div id="source" style="LEFT: 7px; WIDTH: 250px; POSITION: absolute; TOP:
    57px"><h1>Header</h1><br><p>Click the button to move this text into the
    other div</p></div>
    <div id="target" style="LEFT: 299px; WIDTH: 250px; POSITION: absolute; TOP:
    62px; HEIGHT: 142px">This is the target div</div>


    </BODY>
    </HTML>
    <script language="JavaScript">
    function moveHTML() {
    var source = document.getElementById("source");
    var target = document.getElementById("target");
    target.innerText = source.innerHTML;
    source.innerHTML = "Contents moved!"
    }
    </script>

    Russell Jones
    Sr. Web Development Editor
    DevX.com

    "Frederiek" <fourwaysstreet@chello.be> wrote in message
    news:3a796ac5$1@news.devx.com...
    >
    > Try with <xmp>the html code</xmp>, or convert "<" and ">" to respectively
    > "&lt;" and "&gt;".
    >
    > cya
    > Frederiek
    >
    >
    > "mat311275" <mat.j@excite.co.uk> wrote:
    > >
    > >Does anyone know a way of displaying the HTML code from one frame in

    another,
    > >complete with tags?
    > >I've been trying document.write, and pre /pre tags, but the browser still
    > >seems to be trying to interpret the tags in what I want to be plain text.
    > >Can it be done?

    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center