473,382 Members | 1,745 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,382 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 10408
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.