JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 6th, 2012, 01:13 PM
korssane korssane is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2011
Posts: 60 korssane User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 22 m 2 sec
Reputation Power: 3
Reflect Javascript array content update from one frame to another one

Hi Guys,

1-I have two frames in my page Frame 1 and frame 2
frame 1 holds a tag where i pull a java script array A1 value items but it is static and it is at the top of my page.

2-The second frames can be the content of different forms. One of the forms allows me to re-run the query i am using to fill my javascript array A1, so automatically the A1 contents will change.
My question is :

How to get new element added in 2 in my javascript array A1 showing in the Frame 1 ?.

In other terms the javascript is being updated in frame 2 and i want to see those updates in frame 1 tag.

Thanks for your help

Reply With Quote
  #2  
Old November 6th, 2012, 02:38 PM
web_loone08's Avatar
web_loone08 web_loone08 is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2008
Posts: 662 web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 9 h 15 m 9 sec
Reputation Power: 69

Reply With Quote
  #3  
Old November 7th, 2012, 01:10 PM
gsharp gsharp is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Posts: 9 gsharp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 6 m 10 sec
Reputation Power: 0
I don't think you can do it that way. I would move the array into the parent of the frames (aka the page that you declare the iframes on). Then from each iframe you can reference the array by doing window.parent.A1.

Reply With Quote
  #4  
Old November 7th, 2012, 03:49 PM
web_loone08's Avatar
web_loone08 web_loone08 is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2008
Posts: 662 web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 9 h 15 m 9 sec
Reputation Power: 69
Quote:
Originally Posted by gsharp
I don't think you can do it that way.


Haha, I gave you a link to thousands of search results; with examples and demos, about javascript iframe communication and you say you don't think it can be done that way.

Quote:
Originally Posted by gsharp
Then from each iframe you can reference the array by doing window.parent.A1.


So if you got it figured out already; then what are you asking?

Reply With Quote
  #5  
Old November 7th, 2012, 04:31 PM
Kravvitz's Avatar
Kravvitz Kravvitz is offline
CSS & JS/DOM Adept
Dev Shed God 30th Plane (19500 - 19999 posts)
 
Join Date: Jul 2004
Location: USA
Posts: 19,894 Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level) 
Time spent in forums: 6 Months 2 Days 19 h 44 m 32 sec
Reputation Power: 4192
Quote:
Originally Posted by web_loone08
So if you got it figured out already; then what are you asking?

The OP (original poster) is korssane. You're responding to gsharp who is saying that it's simpler to keep the array in the parent document.
__________________
Spreading knowledge, one newbie at a time. I'm available for hire at Dynamic Site Solutions.

Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

Remember people spend most of their time on other people's sites (so don't violate web design conventions).

Reply With Quote
  #6  
Old November 7th, 2012, 05:29 PM
web_loone08's Avatar
web_loone08 web_loone08 is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2008
Posts: 662 web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level)web_loone08 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 9 h 15 m 9 sec
Reputation Power: 69
Quote:
Originally Posted by Kravvitz
The OP (original poster) is korssane. You're responding to gsharp who is saying that it's simpler to keep the array in the parent document.


Yeah, your right Kravvitz... my fault korssane. I was working on something and trying to respond, at the same time. The point that I was making, was that the OP... could have found the solution by searching for "iframe communication"; which would have given a "remote control" iframe/parent.document communication and several other examples, such as: HTML5 postMessage - for a cross domain solution.

At any rate... korssane, a basic example would be something like gsharp and Kravvitz is talking about; something such as:

Parent Document

Code:
<script>
function getArray(myArray)
{
alert(myArray);
}
</script>

<iframe src="framed_page.html"></iframe>


framed_page.html

Code:
<script>
var demoArray = ["Hello korssane!"];
</script>

<a href="#" onclick="parent.getArray(demoArray[0]);return false">Click Me</a>


In the basic example above; the document(s) must remain under the same domain, because of the Same-Origin (domain security) policy (most modern browsers implore). If you need a cross domain approach; you might want to look into "HTML5 postMessage", as I briefly mentioned above.

Last edited by web_loone08 : November 7th, 2012 at 07:10 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Reflect Javascript array content update from one frame to another one

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap