Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder
    Join Date
    Jul 2005
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how to get across

    How would i go abouts storing a javascript variable from one iframe to another, then retrieving it in another? Reson is im refreshing 1 iframe, displaying on another and sending it to another to check for changes.....i cant get it to work right :S

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Take a look here, this may help you

    http://www.huntingground.freeserve.c...pass_data2.htm
    Last edited by Mr J; 05-04-2006 at 02:07 PM.
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #3
    New Coder
    Join Date
    Mar 2006
    Location
    São Paulo, Brazil
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    just remebering, you can use this property on frames too, not just on iframes.
    ----
    As coisas mais simples são as mais importantes.
    ---------
    Thompson M1A1: D-Day
    ----------------

  • #4
    Regular Coder
    Join Date
    Jul 2005
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    uhmmm what i wanted was to store a value in a variable in another page..not an input

    such as

    iframe 1: var whatever

    iframe 2: changes what var whatever is in iframe 1

    iframe 3: gets var whatever fromiframe 1

  • #5
    Senior Coder
    Join Date
    Jul 2005
    Location
    New York, NY
    Posts
    1,084
    Thanks
    4
    Thanked 19 Times in 19 Posts
    Well, I'm not positive, and I'd have to do some tests to verify this but:

    The running context of each script is the window that it is executed in. I believe that iframes and regular frames are separate running contexts from each other. Therefore you must end up treating the frames as objects with properties and methods (parent.frames[0].variable or parent.frames[1].method(param) ).

    Unless they are publicly accessible on an object, they aren't accessible except within the running context, and as per my belief, each frame has its own context.

  • #6
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    The inputs are only examples, all you have to do is change

    document.FormName.ElementName.value

    to the variables name and assign it the appropriate value in the relative iframe

    Try the examples in the attached zip
    Attached Files Attached Files
    Last edited by Mr J; 05-04-2006 at 11:13 PM.
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #7
    Regular Coder
    Join Date
    Jul 2005
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Mr J
    The inputs are only examples, all you have to do is change

    document.FormName.ElementName.value

    to the variables name and assign it the appropriate value in the relative iframe

    Try the examples in the attached zip
    the page im displaying on is being changed from another page, ive done

    parent.frames['FRAME'].DIVID.innerHTML=WHATEVER;

    it works on IE but not firefox..any idea why?

  • #8
    Regular Coder
    Join Date
    Jul 2005
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jeromepelletier
    the page im displaying on is being changed from another page, ive done

    parent.frames['FRAME'].DIVID.innerHTML=WHATEVER;

    it works on IE but not firefox..any idea why?
    guess i should elaborate...the part where i display it doesnt change but when i call it up as a variable and display it in a alert its fine..

  • #9
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    parent.frames['FRAME'].DIVID.innerHTML=WHATEVER;

    will only work in IE for firefox you need

    parent.frames['FRAME'].document.getElementById(DIVID).innerHTML=WHATEVER;

    If this still does not work post your code or zip your files and attach here
    Last edited by Mr J; 05-05-2006 at 01:52 PM.
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #10
    Regular Coder
    Join Date
    Jul 2005
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Mr J
    parent.frames['FRAME'].DIVID.innerHTML=WHATEVER;

    will only work in IE for firefox you need

    parent.frames['FRAME'].document.getElementById(DIVID).innerHTML=WHATEVER;

    If this still does not work post your code or zip your files and attach here
    just gives me an undefined error....hmmmmmmm ima try something if not ill be back

    Alrighty, i was able to fix it by just comparing 2 variables changed on the same page and changing the whole pages innerHTML on the on the one i was changing
    Last edited by jeromepelletier; 05-05-2006 at 04:35 PM.


  •  

    Posting Permissions

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