www.webdeveloper.com
Results 1 to 12 of 12

Thread: parent and Iframe problem writing to textbox.

  1. #1
    Join Date
    Oct 2008
    Posts
    18

    Question parent and Iframe problem writing to textbox.

    Can't seem to get this to work?

    This function is in the Parent

    Tried this does'nt work->
    Code:
    parent.document.generator1a.['frm2'].nameid.value="Welcome"
    Tried this does'nt work, thats weird ->
    Code:
    parent.document.generator1a['frm2'].nameid.value="Welcome"
    I did try without the parent.
    Code:
    document.generator1a['frm2'].nameid.value="Welcome"
    this is frm2

    Code:
    <form action="#" name="generator1a">
    <div>
    <input style="color: pink; background-color: black" type='text'  name='nameid' id='nameid' value='0' />
    </div>
    </form>

  2. #2
    Join Date
    Jan 2009
    Posts
    11
    To update the content of input field from document:
    HTML Code:
    document.generator1a.nameid.value="Welcome"
    To update [b]from parent[\b] an iframe content, try something like this (i'm not sure about the syntax):

    HTML Code:
    document.frames[frm2].document.generator1a.nameid.value="Welcome"

  3. #3
    Join Date
    Oct 2008
    Posts
    18

    Parent iframe problem writing to textbox

    Hmm did not work??
    should I take it out of
    'forms' 'generator1a' is form name I put the parent in there because it did not work with it or without

    Code:
    parent.document.frames[fr2].document.generator1a.usercounter7.value="Welcome"
    Like this
    Code:
    parent.document.frames[fr2].document.usercounter7.value="Welcome"
    Last edited by orlando; 01-10-2009 at 07:18 AM.

  4. #4
    Join Date
    Jan 2009
    Posts
    11
    this code works in IE6:
    HTML Code:
    document.frames["fr2"].document.generator1a.usercounter7.value="Welcome"
    ("fr2" is the name of iframe).

    Regarding the parent issue - when you write 'parent.document' outside the iframe, you are getting to the parent of iframe parent
    Last edited by nika; 01-10-2009 at 07:42 AM.

  5. #5
    Join Date
    Oct 2008
    Posts
    18
    I am Using IE 7.0.
    parent source I am not writing the full source its to large just
    writing parts

    did not work?.
    Code:
    <button type="button" onclick="reloadxx()">test call</button>
    
    <script type="text/javascript">
    
    
    function reloadxx() {
    
    alert("ready")
    
    
    
    document.frames["fr2"].document.generator1a.usercounter7.value="Welcome"
    
    
    alert("if it gets here it worked!")
    }
    </script>

    fr2 source

    Code:
    <form action="#" name="generator1a">
    <div>
    <input style="color: pink; background-color: black" type='text'  name='usercounter7' id='UserCounter7' value='0' />usercounter7
    </div>
    </form>
    Last edited by orlando; 01-10-2009 at 07:49 AM.

  6. #6
    Join Date
    Mar 2008
    Posts
    24
    parent.fr2.document.generator1a.usercounter7.value="Welcome"

  7. #7
    Join Date
    Oct 2008
    Posts
    18
    lepi Thanks it worked! at first it did 'nt.
    parent.fr2 - my iframe name is frm2 .


    Code:
    parent.frm2.document.generator1a.usercounter7.value="Welcome"

  8. #8
    Join Date
    Mar 2008
    Posts
    24
    u said fr2 in ur posts :P
    and u r welcome

  9. #9
    Join Date
    Oct 2008
    Posts
    18
    sorry my typos... I was typing to fast...

  10. #10
    Join Date
    Mar 2008
    Posts
    24
    u can use this code too (as i remember)

    parent.frames["frm2"].document....

  11. #11
    Join Date
    Oct 2008
    Posts
    18
    Cool I like your first source.

    I added it to my Javascript source code collection.

    Code:
    parent.frm2.document.generator1a.usercounter7.value="Welcome"

  12. #12
    Join Date
    Mar 2008
    Posts
    24
    kewl
    chears

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