473,671 Members | 2,288 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems getting document title from iframe

Folks,
I want to be able to get title of a document that is presented within an Iframe with the id
"popupFrame ". There may be more than 1 instance of the iframe in the page.
This is my code:

var elementCount = document.all("p opupFrame").len gth;
for (var i = 0 ; i < elementCount ; i++)
{
alert("src = " + document.all("p opupFrame",i).s rc);
alert("title = " + document.all("p opupFrame",i).d ocument.title);
}
But the wierd thing is that the title is always the title of the document that contains the Iframe.
NOT the title of the document conatined within the Iframe.
At least in IE7 which is all that I have tested it with so far.
Any ideas? What am I missing?
TIA - Adam
Jun 12 '07 #1
3 3128
Sorry I should have added that the Iframe src is always correct.

i.e. alert("src = " + document.all("p opupFrame",i).s rc) displays the correct url but
alert("title = " + document.all("p opupFrame",i).d ocument.title) displays the title of the document
that contains the iframe.
Thanks...
Adam Lipscombe wrote:
Folks,
I want to be able to get title of a document that is presented within an
Iframe with the id "popupFrame ". There may be more than 1 instance of
the iframe in the page.
This is my code:

var elementCount = document.all("p opupFrame").len gth;
for (var i = 0 ; i < elementCount ; i++)
{
alert("src = " + document.all("p opupFrame",i).s rc);
alert("title = " + document.all("p opupFrame",i).d ocument.title);
}
But the wierd thing is that the title is always the title of the
document that contains the Iframe. NOT the title of the document
conatined within the Iframe.
At least in IE7 which is all that I have tested it with so far.
Any ideas? What am I missing?
TIA - Adam
Jun 12 '07 #2
ASM
Adam Lipscombe a écrit :
Folks,
I want to be able to get title of a document that is presented within an
Iframe with the id "popupFrame ". There may be more than 1 instance of
the iframe in the page.
You can't have more than *one* element with same *id* !!!
<iframe name="myFrame" src="test.htm" blah></iframe>

<a href="javascrip t:alert(parent. myFrame.documen t.title);">my frame
document title</a>
This is my code:

var elementCount = document.all("p opupFrame").len gth;
for (var i = 0 ; i < elementCount ; i++)
{
alert("src = " + document.all("p opupFrame",i).s rc);
alert("title = " + document.all("p opupFrame",i).d ocument.title);
}
for (var i = 0 ; i < elementCount ; i++)
{
alert("src = " + document.all["popupFrame "][i].src);
if(document.all ("popupFrame ")[i].document &&
document.all("p opupFrame")[i].document.title )
alert("title = " + document.all("p opupFrame")[i].document.title );
}
But the wierd thing is that the title is always the title of the
document that contains the Iframe. NOT the title of the document
conatined within the Iframe.
At least in IE7 which is all that I have tested it with so far.
Any ideas? What am I missing?
document.all("p opupFrame")[i] ????
document.all["popupFrame "][i] ????
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Jun 17 '07 #3
ASM said the following on 6/16/2007 9:41 PM:
Adam Lipscombe a écrit :
>Folks,
I want to be able to get title of a document that is presented within
an Iframe with the id "popupFrame ". There may be more than 1 instance
of the iframe in the page.

You can't have more than *one* element with same *id* !!!
<iframe name="myFrame" src="test.htm" blah></iframe>

<a href="javascrip t:alert(parent. myFrame.documen t.title);">my frame
document title</a>
That is a joke, right?

<URL: http://jibbering.com/faq/index.html#FAQ4 _24>
>This is my code:

var elementCount = document.all("p opupFrame").len gth;
for (var i = 0 ; i < elementCount ; i++)
{
alert("src = " + document.all("p opupFrame",i).s rc);
alert("title = " + document.all("p opupFrame",i).d ocument.title);
}

for (var i = 0 ; i < elementCount ; i++)
{
alert("src = " + document.all["popupFrame "][i].src);
document.all?? Shame, shame..... window.frames.

--
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/
Jun 17 '07 #4

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

Similar topics

0
2086
by: Dan Popa | last post by:
Check out the following 2 links: http://www.batisdev.com/admin/test_1images.asp http://www.batisdev.com/admin/test_2images.asp First page contain 4 IFRAMES and 1 IMG tags. Second page contain 4 IFRAMES and 2 IMGs tags. The problem is that the second IFRAME from the second page generates fires a new session.
12
5925
by: Justin Koivisto | last post by:
I am having a problem with Internet Explorer and javascript on a WYSIWYG editor I am creating. It all works in Mozilla, but IE returns flase for queryCommandEnabled('forecol'). JS isn't my strong suit, so I am turning to all you experts for help. What am I missing here? Other commands like formatblock, fontsize and fontname all work fine, so I assume that it has something to do with not getting the correct selection because of the iframe....
8
9411
by: '69 Camaro | last post by:
Perhaps I'm Googling for the wrong terms. Does anyone have links to examples of the syntax necessary to read the HTML on another Web page when that HTML is produced from JavaScript using the document.write( ) method? For a simplified example, I have two Web pages. Page 1 uses JavaScript with the following: htmlData = "<B>This is bold text.</B>"; document.write(htmlData);
9
11163
by: aatcbbtccctc | last post by:
Hi folks I've googled for an answer to this, with no success. Can someone please jump in, and put me out of my misery! (I'm sure it's quite simple) I have an invisible IFRAME, and a visible DIV: <IFRAME id=myframe style="display:none" src="..." onload="ShowNews(this)"></IFRAME>
12
11133
by: mistral | last post by:
Can anybody tell me how to get source code of page in iframe? (popup window is clickable image). When I right click on this popup border to view source, i see just as follows <html> <head> <title>New offer!</title> </head> <body style="margin-left: 0%; margin-right: 0%; margin-top: 0%;
3
4056
by: Asterbing | last post by:
I want to know the length in pixels of a document embedded in a iframe. The way I go seems to work under IE but not under Firefox (about other browsers I'll see later). Here is my page for testing : 1) The page which will appear in the iframe is : <html> <head>
10
3744
by: AC | last post by:
I had a page that does some event setup on window.onload: function prepEvents() { document.getElementById("menumap_sales").onmouseover = swapMenuSales; // etc } window.onload = prepEvents;
23
6583
by: vunet | last post by:
It is recommended by some sources I found to create IFrames in IE using document.createElement('<iframe src="#">') instead of document.createElement('iframe'). Why and what browser versions to use it? IE5 or IE6? Thanks
8
7197
by: removeps-groups | last post by:
Is there any way to control the space between top of browser or frame and document body? What I have is this: There is a simple file test1.html, and file test.html that displays test1.html in an iframe. On the iframe I set marginheight and marginwidth to zero. But there is one line of blank space between the top border of the iframe and the first line of text. However, the iframe's content document's body's offsetHeight gives the...
0
8388
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
8907
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
8817
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
8593
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
7423
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...
1
6218
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4396
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1799
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.