473,545 Members | 2,001 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why parentNode has no properties?

RC
I have a simple test page with frames

<html><title>Ti tle A</title>

<frameset rows="50%,*">
<frame src="frame1.htm l" name="frame1" />
<frame src="frames.htm l" name="frame2" />
</frameset>
</html>

In frame1.html I want to get the parent's title and
change it

function changeTitle(new Title) {

var upperNode = document.parent Node;
var upperTitle = upperNode.title ;
alert(upperTitl e);
upperNode.title = newTitle;
}
The problem is 2nd line, error message says
upperNode has no properties.

But I check the DOM console in Firefox, it has properties, include the
title.

Please help how to change the Web browser's title?
Thank Q very much!
May 31 '07 #1
1 1434
RC wrote:
var upperNode = document.parent Node;
The document node is the root of the DOM tree so it does not have a
parent node. If you are scripting a frame and you are looking for the
_parent window_ then use e.g.
window.parent
to access the parent window and then e.g.
window.parent.d ocument.title
to access the title of the document in the parent window (for instance
the title of the frameset document).

--

Martin Honnen
http://JavaScript.FAQTs.com/
May 31 '07 #2

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

Similar topics

3
1916
by: Michael Hill | last post by:
I am trying to get all the "polyline" tags and then find the parent node above it so I can transform it. var poly = svgDocument.getElementsByTagName("polyline"); for ( var i=0; i < poly.length; i++ ) { myobj=poly.parentNode(i); alert(i + myobj); }
1
1885
by: JoostV | last post by:
However, I am wondering if I can make the creation of my object depend on the name of the parent node DURING parsing (or even the name of the grandparent node)?? In other words, how can I do something like this: class MyParser : XmlDocument { public override XmlElement CreateElement(string prefix, string lname, ...) { //--> where can I...
5
6207
by: anupamjain | last post by:
An interesting thing is happening. My table doesnt have 'TBody', but the elem.parentNode.tagName is returning 'TBody' where elem refers to the 'tr' tag. Shouldnt it be returning 'table' ? <body> <table> <tr> <td>1</td>
1
8240
by: yawnmoth | last post by:
Given an element ID, is there a way to figure out what index one would need to use in the parentNode's childNodes array to get at that element? For example... <body> <div id="parent"> <div id="a">a</div> <div id="b">b</div>
3
5789
by: pgasston | last post by:
Hi, I have a script which loops through all <areatags of an imagemap and changes the visibility of a hidden <div(using MooFX for the transition). The same script then searches each <divto find the <a class="close_box"tag which toggles back to invisible. The script works fine in FF, Opera & Safari, but the second half of the function -...
2
4439
by: DanielLinn | last post by:
I'm getting an error in IE 6.0.2800 that says "Error: Not implemented." when I try to get a parent. Does it whether or not 'compatibility mode' is on. Here's my code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">...
2
15801
by: amattie | last post by:
Anyone know what the specific difference is between the offsetParent and parentNode properties of a DOM element are? Mozilla's docs on the DOM element (http://developer.mozilla.org/en/docs/DOM:element) don't really indicate much of a difference, but whatever the difference is is really screwing me up in one of my projects. On a specific div...
7
37883
by: webdeveloper | last post by:
Without showing any code, I thought maybe somebody already knows what the error message in the title generally means? But in short, a menu is supposed to display by setting its inline style attribute to: display="none" vs 'display="block" upon an onclick of an "<a>" element. That link ("<a>") element is accessed via DOM by using something...
1
2058
by: RC | last post by:
I have a simple test page with frames <html><title>Title A</title> <frameset rows="50%,*"> <frame src="frame1.html" name="frame1" /> <frame src="frames.html" name="frame2" /> </frameset> </html>
2
8103
by: bent27 | last post by:
I'm new to javascript...I'm getting 'parentNode' is null or not an object error in the following code for (var ci=0;ci<headerLink.parentNode.childNodes.length;ci++) { if (headerLink.parentNode.childNodes.tagName && headerLink.parentNode.childNodes.tagName.toLowerCase() == 'span') span = headerLink.parentNode.childNodes; } ...
0
7411
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...
0
7669
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. ...
0
7926
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...
0
7773
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...
1
5343
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...
0
4962
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
3468
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
3450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1028
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.