473,574 Members | 2,267 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 3121
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
2079
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
5913
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...
8
9409
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...
9
11156
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
11129
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
4048
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
3738
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
6568
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
7196
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...
0
7832
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...
0
7747
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...
1
7843
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...
0
6498
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...
0
5331
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...
0
3768
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...
0
3785
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2262
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1364
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.