473,831 Members | 2,237 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.getEle mentById("LHS") ;

and i get a "Access Denied"

is there a way to do this ?

thanks in advance

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

I tried:
parent.MYFRAME. document.getEle mentById("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...@g ooglemail.comwr ote:
On 18 Apr, 01:30,Mel<MelHe r...@gmail.comw rote:
I need to access an element of my top window from inside an IFrame
within that window.
I tried:
parent.MYFRAME. document.getEle mentById("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...@gmai l.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...@gmai l.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.javas cript 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
297
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
1291
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! Thanks!
0
2478
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 open a report. Reports seem to only be able to to open within the Access Window itself (or am I missing something?) To work around this I use a scheme that opens the report maximized, then unhides and maximizes the MS Access window using ...
2
5832
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 from the code behind c# module? I tried: (TextBox)Page.FindControl("TextBox1") but that will result in a null pointer. I also tried: (TextBox)Page.FindControl("ContentPlaceHolder1.LoginView1.TextBox1") with the
2
2017
by: joe | last post by:
how to access invisible column inside gridview
3
1478
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
6469
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 doSomethingInDiffWindow() { // do something // open up a pop-up modal window // continue back on doing something after pop-up modal window
1
2186
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 , . I want to incorporate this into a detailsview like so... <asp:TemplateField HeaderText="Name:"> <ItemTemplate> <%#Eval("firstname")%>, <%#Eval("lastname")%> </ItemTemplate> </asp:TemplateField> ...
1
2863
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 function inside Iframe How to fix it - please send me code... Thanks
1
1825
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 CustomerName SaleRepName ContractNumber ContractDate I need to include data that shows the products and their respective serial numbers owned by the customer. A customer can have multiple products. For example:
0
9793
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10777
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10493
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10526
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10206
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9315
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
3076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.