www.webdeveloper.com
Results 1 to 3 of 3

Thread: Editing an IFrame with Javascript

  1. #1
    Join Date
    Oct 2010
    Posts
    1

    Editing an IFrame with Javascript

    I am referencing an iframe from another server in my website. The iframe is in a table format, and I want to get rid of the top two rows of the table for my website.

    Is there any way I could display the iframe without the first two rows?

  2. #2
    Join Date
    Feb 2009
    Location
    UK
    Posts
    142
    If the other server is effectively the same domain it should be possible. If not, not.
    On my geographical filter page I load an IFRAME 4 times and inspect for a given parameter, extract the whole of the <TR> if it agrees and stitch together 4 tables of results.
    I have had a frustrating few months figuring which of the various way to get at the text but finding the IFRAME by id (getElementByID) and then getting the rows by TAG (getElementsByTag - I think).
    But there were several blind allies to the best pointer. innerHTML works on some, document.body.firstChild etc - I use FireFox and FireBug to find the pointers. I am sure there is a logic and syntax to the pointers but not in my head!

    If you need help try looking at my code at http://www.users.waitrose.com/~cresby/fcctest3.htm but there are 800 lines just in the main file (.js). Best of luck. (I am not at my computer right now).

  3. #3
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    use something LIKE:

    Code:
    var iframe=document.getElementById("iframe1);
    [].slice.call(iframe.contentWindow.document.getElementsByTagName("tr")).map(function(a,b){
      if(b<3){a.style.display='none'; }
    });

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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



Recent Articles