SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru afridy's Avatar
    Join Date
    Mar 2007
    Posts
    960
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Accessing an element in iframe Not working. strange...

    Hai folks,

    my document have form to ad candiates.
    the form also has an iframe, in that an HTML file upload is kept. when a user uploads a file, on success, a div is shown telling upload success.
    now, when the user completed the form, i am resetting the form element. so i want to make the text in the div mentioned about to be 'none'.

    Code:
    window.frames['frame_cv'].document.getElementById('res_cv_attach').innerHTML='none';
    * frame_cv' = iframe id
    * res_cv_attach = div's id

    This does not work

  2. #2
    SitePoint Addict
    Join Date
    Apr 2011
    Posts
    266
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi
    Try with iframe.contentWindow .
    Example:
    Code:
    var myIFrame = document.getElementById(iframe_id);
    myIFrame.contentWindow.document.getElementById('res_cv_attach').innerHTML = 'none';
    Or see this tutorial: Get and modify content of an Iframe .
    Free: Web Programming Courses HTML, CSS, Flash
    Web Programming: AJAX Course and PHP-MySQL Course video Lessons
    Good JavaScript and jQuery course for beginners

  3. #3
    SitePoint Guru afridy's Avatar
    Join Date
    Mar 2007
    Posts
    960
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MarPlo View Post
    Hi
    Try with iframe.contentWindow .
    Example:
    Code:
    var myIFrame = document.getElementById(iframe_id);
    myIFrame.contentWindow.document.getElementById('res_cv_attach').innerHTML = 'none';
    Or see this tutorial: Get and modify content of an Iframe .
    Thant works charm!! thanks buddy !!!!


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
  •