SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Aug 2006
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    show source code of ...

    I have a textarea and an iframe. I want to show source code of http://www.google.com.tr in textaera. I wrote the following code. It is not showing. What is my error? Thanks...

    Code:
     
    <script type="text/javascript">
    
    function show () {
    
    var t = document.getElementById('myTextarea');
    
    t.value = window.frames["myIframe"].document.getElementsByTagName('html')[0].innerHTML ;
    
    }
    
    </script>
    
    <button onclick="show ()">show source </button>
    
    <textarea id="myTextarea"> </textarea>
    
    <iframe src="http://www.google.com.tr/" name="myIframe"></iframe>
    After a long time....

    I changed this:
    <textarea id="myTextarea"> </textarea>
    to this:
    <textarea id="myTextarea" cols="20" rows="20"> </textarea>
    Now, I see source code.
    Last edited by muazzez; Feb 4, 2007 at 14:51.

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The cols and rows attributes are required for the TEXTAREA element. Validating your markup would have told you this immediately. (Hint hint )
    Birnam wood is come to Dunsinane


Bookmarks

Posting Permissions

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