473,325 Members | 2,308 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,325 software developers and data experts.

How do I get <TITLE> from frame?

Hello,
I am trying to find the <TITLE> element of my document. Normally

alert(document.title);

works just fine, but when this statement is within a page that is a
frame in a larger document, the above call always returns the title of
the parent (container) page. Is it possible through JS to deduce the
<TITLE> element of the current page, even if that page is a frame?

Much thanks - Dave
Jul 20 '05 #1
3 10074
D. Alvarado wrote:
Hello,
I am trying to find the <TITLE> element of my document. Normally

alert(document.title);

works just fine, but when this statement is within a page that is a
frame in a larger document, the above call always returns the title of
the parent (container) page. Is it possible through JS to deduce the
<TITLE> element of the current page, even if that page is a frame?

Much thanks - Dave


alert(top.document.title);

Mick
Jul 20 '05 #2
Thanks for the reply, but I think I misphrased my question. If my
"top" document is:

<html>
<head><title>Top</title></head>
<body>
<table>
<tr><td><iframe width="200" height="300" src="frame.htm"
name="n"></iframe></td></tr>
</table>
</body>
</html>

and my frame, "frame.htm" is:

<html>
<head><title>Frame</title></head>
<body>
<script type="text/javascript">
alert(document.title);
</script>
</body>
</html>

I want the alert to say "Frame" not "Top," which is what displays with
the current text or even if I include the suggestion
"alert(top.document.title)". Again, much thanks if someone can crack
this enigmatic problem. -

Mick White <mw******@BOGUSrochester.rr.com> wrote in message news:<sh*******************@twister.nyroc.rr.com>. ..
D. Alvarado wrote:
Hello,
I am trying to find the <TITLE> element of my document. Normally

alert(document.title);

works just fine, but when this statement is within a page that is a
frame in a larger document, the above call always returns the title of
the parent (container) page. Is it possible through JS to deduce the
<TITLE> element of the current page, even if that page is a frame?

Much thanks - Dave


alert(top.document.title);

Mick

Jul 20 '05 #3
Ivo
"D. Alvarado" <la***********@zipmail.com> wrote in message
news:9f*************************@posting.google.co m...
Thanks for the reply, but I think I misphrased my question. If my
"top" document is:

<html>
<head><title>Top</title></head>
<body>
<table>
<tr><td><iframe width="200" height="300" src="frame.htm"
name="n"></iframe></td></tr>
</table>
</body>
</html>

and my frame, "frame.htm" is:

<html>
<head><title>Frame</title></head>
<body>
<script type="text/javascript">
alert(document.title);
</script>
</body>
</html>

I want the alert to say "Frame" not "Top," which is what displays with
the current text or even if I include the suggestion
"alert(top.document.title)". Again, much thanks if someone can crack
this enigmatic problem. -


Weird, which browser are you using? I get the correct titles when trying
this in IE6/WinME: different results for alert(document.title) and
alert(top.document.title). Both can even be changed dynamically (although
there is litle point in doing that with the framed document). Strange is,
however, that the actual text displayed in the titlebar is not always
updated, when trying forexample, to make top.document.title=document.title,
and then there is no way to confirm if it worked as the top.document.title
string will reflect the new value.
Ivo
Jul 20 '05 #4

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

Similar topics

13
by: mark | last post by:
IF I have something like this: <title><?php print($pagetitle); ?></title> <body> <?php include("folders/my_include.php"); ?> </body> </html> and my_include.php contains the value to the...
5
by: Info 3000 | last post by:
Hi there, Simple question, but headache ! I have a PHP Page like : <HTML> <HEAD> <TITLE>Sunny day !</TITLE> </HEAD>
2
by: Irene | last post by:
Hi, I would like to modify the text within an html title tag based upon a value read from the registry (or the existence of a certain file). For example, if a certain registry value is equal...
1
by: Andreas Klemt | last post by:
Hello, I have in my strHtml a html page. so what is the fastest way (with XML Read?) to get the "myValue" between <title>myValue</title> Thanks, Andreas
6
by: Alex | last post by:
Hi, is it possible to set the title programatically from the code behind page. I placed a literal in the head section of the form and set its text property. it seemed to work bu the literal...
8
by: DC | last post by:
In HTML page, I put: <html> <head> <title>Article: <asp:Label ID="lblHTMLTitle"></asp:Label> </title> .... In the code behind: ....
5
by: Carlo Marchesoni | last post by:
Is it possible to change the document's title property from code behind (c#) ? I need to build a dynamic title at runtime.
4
by: David Thielen | last post by:
Hi; If I am using master pages, how do I set the <title> and <meta name='description' content='my title'> for each page. Obviously each page will have a different title & description. --...
15
by: Steve B | last post by:
Is there a way to manipulate the <TITLEin the csharp code?
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.