473,396 Members | 1,898 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 can I access and element in the Top Window from Inside an Iframe

Mel
I need to access an element of my top window from inside an IFrame
within that window.

I tried:
parent.MYFRAME.document.getElementById("LHS");

and i get a "Access Denied"

is there a way to do this ?

thanks in advance

Apr 18 '07 #1
5 10410
On 18 Apr, 01:30, Mel <MelHer...@gmail.comwrote:
I need to access an element of my top window from inside an IFrame
within that window.

I tried:
parent.MYFRAME.document.getElementById("LHS");

and i get a "Access Denied"
You should be using just:

parent.document.getElementById("LHS")

That is, the MYFRAME bit shouldn't be there.

Also, the document loaded within the iframe needs to be on the same
server as the parent document. Javascript can't access documents
across different domains for security reasons.

wp.

Apr 18 '07 #2
Mel
On Apr 18, 6:27 am, wisestpotato <wisestpot...@googlemail.comwrote:
On 18 Apr, 01:30,Mel<MelHer...@gmail.comwrote:
I need to access an element of my top window from inside an IFrame
within that window.
I tried:
parent.MYFRAME.document.getElementById("LHS");
and i get a "Access Denied"

You should be using just:

parent.document.getElementById("LHS")

That is, the MYFRAME bit shouldn't be there.

Also, the document loaded within the iframe needs to be on the same
server as the parent document. Javascript can't access documents
across different domains for security reasons.

wp.
when I use
parent.document.getElementById("LHS")

i get "Access Denied" can you please help ?

Apr 18 '07 #3
On 18 Apr, 15:56, Mel <MelHer...@gmail.comwrote:
when I use
parent.document.getElementById("LHS")

i get "Access Denied" can you please help ?
Is the document within the iframe on the same server, at the same
domain, as the parent document that is hosting the iframe? If not, you
will get the permission denied error.

wp.

Apr 18 '07 #4
wisestpotato said the following on 4/18/2007 11:25 AM:
On 18 Apr, 15:56, Mel <MelHer...@gmail.comwrote:
>when I use
parent.document.getElementById("LHS")

i get "Access Denied" can you please help ?

Is the document within the iframe on the same server, at the same
domain, as the parent document that is hosting the iframe?
Same domain required: yes (with an exception)
Same *server* required: Not even close.

The exception is sub-domains with the document.domain property set.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 18 '07 #5
On 18 Apr, 18:39, Randy Webb <HikksNotAtH...@aol.comwrote:
wisestpotato said the following on 4/18/2007 11:25 AM:
Is the document within the iframe on the same server, at the same
domain, as the parent document that is hosting the iframe?

Same domain required: yes (with an exception)
Same *server* required: Not even close.
I did not say that the same server is required, not did I mean to
imply that - sorry if I was unclear. I was trying to whittle down the
possible problems by getting a clearer idea of the situation.

wp.

Apr 19 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Henrik | last post by:
How do you access another window? For example if u whant tpo write something in a textbox in an other opwn window?
1
by: Socrat | last post by:
HI! Need to have command window inside main frame of application, something like Command Window in MATLAB Is any example for Visual C++ available in I-net? Any help will be appretiated! ...
0
by: lauren quantrell | last post by:
I have an Access 2000 application and I am using ShowWindow to hide the MS Access application window. Works fine as long as there is a popup form open all the time. The problem is when I want to...
2
by: LLars | last post by:
Hey, I have the following problem: I have an asp-page which contains a loginview with two templates (loggedin- and anonymoustemplate). How can I access a textbox inside the the loggedintemplate...
2
by: joe | last post by:
how to access invisible column inside gridview
3
by: peterfsorenson | last post by:
It must be a simple answer, but I am trying to figure out if there is a way either by mouse action or element selected if the element is INSIDE an Iframe. Thanks
3
by: Jimmy | last post by:
Is it possible to open a pop-up browser window (modal-style) inside another browser? e.g. // assuming something is calling this function inside the html as some event got triggered function...
1
by: ajrock2000 | last post by:
I am using a DetailsView to display some data. I am basically getting a firstname, and lastname fields from a database (the database cannot be changed, nor the queries), and I must concatenate the ,...
1
by: hpandya | last post by:
Here is my code::: <iframe id="test" name="test" width="840" height="880" frameborder="no" scrolling="no" onmousedown=alert("wow")></iframe> what is wrong why cant i get mousedown...
1
by: KrazyKasper | last post by:
MS Access 2003 – table inside a report I have an Access report that I use in a mail merge (export to Excel and then mail-merge into a Word document). The report currently shows: CustomerId...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.