473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how Iframe access varible from other frame?

123 100+
Hi,

I have a page, it include a iframe inside, but how to make the iframe can access
the variable from it outer frame?

outframe id= frameout....it have a variable ...var intnumber,
iframe id=framein.


Expand|Select|Wrap|Line Numbers
  1. if (top.document.frameout.intnumber=="1")
  2. {
  3. }
  4. else
  5. {
  6. }
  7.  
I use something like above, it not work..please help...
I have tried parent.document.frameout.intnumber as well...
Nov 13 '07 #1
1 2779
Dasty
101 Expert 100+
Javascript global variables are properties of window object, so accessing global variable of parent's frame would look like:

if (parent.intnumber == 10) { ....

It's better to address frames relatively, because you can not know if you will not put the whole conent into one more iframe in the future (so top will address different frame).

so to access parent frame use "parent",
to access child frames use: "frames["name_of_child_frame"]"

EDIT: and dont forget you can access differen frame's content only if they are from the same domain.
Nov 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Martin | last post by:
There seems to be some strange behaviour when trying to get the scrollHeight and scrollTop of an iframe in IE6. I have tried several ways of getting these values when the iframe is written into...
3
by: coolsti | last post by:
I need some help here. I am making an application which allows a user to look at a series of picture files one at a time, and enter the outcome of various visual tests to a database. The...
3
by: Angel | last post by:
How do I get the reference of the IFrame from the asp.net webpage that is being displayed within that IFrame? In other words I have an IFrame in my page. Within that IFrame Set the source to a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.