Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jul 2009
    Location
    Sao Paulo
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to Use HTML Inside a Text Area Box

    Hi,

    I have the following form. The html file was saved on my HD and in true it is a full text.

    Now I want to see that file inside the <textarea> when the user on click that link and at the same time shows the textarea (instead onclick checkbox).

    <form>
    <A HREF="ww_HTMLView.html">ww_HTMLView.html</A>
    <input type="checkbox" onclick = "urltxt.style.visibility = (this.checked) ? 'visible' : 'hidden'" />
    <textarea name="urltxt" style="visibility:hidden"></textarea>
    </form>
    Four 750

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    How about using an iframe?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Jul 2009
    Location
    Sao Paulo
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    I would need to open in a textarea such page.



    Four 750

  • #4
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,026
    Thanks
    36
    Thanked 494 Times in 488 Posts
    Could use ajax to read and display the HTML text
    but it will NOT execute from the <TEXTAREA>.

    The <iframe> would be used to display and act on the HTML.

  • #5
    New to the CF scene
    Join Date
    Jul 2009
    Location
    Sao Paulo
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Hi,

    I believe I am was too clear. The SOURCE CODE of that HTML PAGE in TRUE are in text format. In other words. No TAGS. It is simply text.

    Four750

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,731
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    Quote Originally Posted by Four750 View Post
    Hi,

    I believe I am was too clear. The SOURCE CODE of that HTML PAGE in TRUE are in text format. In other words. No TAGS. It is simply text.

    Four750
    If it is simply text, why is it not a .txt file?
    You will need AJAX to read and display a text file.

    If you use an iframe (as suggested) then you can dsiplay the content as follows:-

    Code:
    <textarea id = "txt1" rows = 30 cols = 60></textarea>
    
    <script type="text/javascript" >
    window.onload=function(){
    var str = document.getElementsByTagName('html')[0].innerHTML;
    
    // edit str as required to remove tags etc.
    
    document.getElementById("txt1").value = str;
    }
    </script>
    You could use a hidden iframe and then copy the HTML from all or part of the iframe to a textarea.
    Last edited by Philip M; 07-30-2009 at 08:05 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •