SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Wizard
    Join Date
    Oct 2004
    Location
    Newport Beach
    Posts
    1,761
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    parentform works in FF, not in IE

    This is a script I have in an iFRAME inside a document. OnClick, the iframe select option should transfer a variable to a textfield in the parent document.

    Code:
    <script type="text/javascript">
    function updateParent(fid){
    
    parentform = parent.document.filteradd;
    
    localform = document.localform;
    
    //update your parents form data with local form data
    
    parentform.feedid.value = fid;
    
    }
    </script>
    The form in the parent is named filteradd. This works in FF, but not IE.

    What am I missing?

    Thanks
    Ryan
    Upcoming Movies - Movie News. Updated Daily.
    Movie Trailers - Awesome trailer site. Nuff said.

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That should work, try parent.document.forms["filteradd"], though that should give you the same.

    If not, try alerting a bit, like
    Code:
    alert(parent.document.filteradd);
    alert(parent.document.filteradd.nodeName);
    and see what results you get

  3. #3
    SitePoint Wizard
    Join Date
    Oct 2004
    Location
    Newport Beach
    Posts
    1,761
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    IE doesn't even give an alert, FF does.

    I don't think it is running it... can't figure it out.

    the form in the iframe has select options that do an onClick

    <option onClick="updateParent('5')">title</option>

    Ryan
    Upcoming Movies - Movie News. Updated Daily.
    Movie Trailers - Awesome trailer site. Nuff said.

  4. #4
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You mean the JS isn't even executed? Then the problem must lie somewhere else...

  5. #5
    SitePoint Wizard
    Join Date
    Oct 2004
    Location
    Newport Beach
    Posts
    1,761
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ???

    I looked through it, can't figure out why. IE doesn't execute, FF does.

    Let me play with it, but suggestions appreciated.

    Ryan
    Upcoming Movies - Movie News. Updated Daily.
    Movie Trailers - Awesome trailer site. Nuff said.

  6. #6
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you have any url where this could be tested?

  7. #7
    SitePoint Wizard
    Join Date
    Oct 2004
    Location
    Newport Beach
    Posts
    1,761
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's on my top-secret project.

    I figured it out:

    It wasn't the javascript, it was the fact that IE does not allow onclick to be used on select options.

    I had to put this in the form head instead:

    onChange="updateParent(''+(this.options[this.selectedIndex].value)+'')"

    works in Firefox too like this.

    Ryan
    Upcoming Movies - Movie News. Updated Daily.
    Movie Trailers - Awesome trailer site. Nuff said.

  8. #8
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah... It always help to post all the relevant code...


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
  •