473,800 Members | 2,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

parentNode Not Implemented?!?

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.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>User Results</title>
<link href="css/screen.css" rel="stylesheet " media="all" />
<script type="text/javascript" language="javas cript">
function highlightRow(el em) {
alert(elem.pare ntNode.parentNo de.id);
parent = findOwner( elem );
parent.classNam e = "highlighte d";
}
function findOwner( elem )
{
var node = elem;
while (node)
{
if ( node.nodeType == node.ELEMENT_NO DE && node.nodeName == "TR")
{
alert("found it");
return node;
}
node = node.parentNode ;
}
alert("didn't find it");
return null;
}
</script>
</head>
<body>
<table cellspacing="0" id="scrollMe" class="formdata ">
<tr id="rowThing">
<td class="center command" id="tdThing"><i nput id="testingThis "
type="checkbox" class="checkEm" name="vehIndex_ 0"
onclick="highli ghtRow(this);" value="0"/>
</td>
</tr>
</table>
</body>
</html>

What's odd is that the first alert will return the proper ID of the row
(using parentNode), but when I use parentNode to assign the parent to a
var, it chokes. Works fine on Moz (surprise, surprise). Any ideas?

Aug 8 '06 #1
2 4451
Da********@frei ghtliner.com wrote:
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.
Because that is irrelevant to the error :-)
>
Here's my code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
It is pointless to try using XHTML with IE, it will treat it as HTML
anyway. Stick to 4.01 strict unless you have some really special
reason to use XHTML, in which case IE becomes irrelevant.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>User Results</title>
<link href="css/screen.css" rel="stylesheet " media="all" />
<script type="text/javascript" language="javas cript">
The language attribute is long since deprecated, just remove it.

function highlightRow(el em) {
alert(elem.pare ntNode.parentNo de.id);
parent = findOwner( elem );
Here you create 'parent' as a global variable, but not until
higlightRow is executed. This is what is actually causing your problem
- IE will not assign the result if the right hand side expression to
it. You can declare parent anywhere - either global or local, local is
better unless you have a reason for it to be global - and your issue
goes away.

parent.classNam e = "highlighte d";
Since findOwner can return null if a TR isn't found, you should test
the returned value - what is the effect of adding a className property
to the null object?

}
function findOwner( elem )
{
var node = elem;
while (node)
{
if ( node.nodeType == node.ELEMENT_NO DE && node.nodeName == "TR")
I can't understand why you bother with the first test - it creates a
dependency on DOM 3 that doesn't seem necessary and is not supported by
my IE 6 - it never finds the TR. Go back to HTML and DOM 2.

If you want this to work on the web, just test the node name since it
is sufficient for your purpose and much more widely supported.

Since you are pretending to use XHTML, you should follow the advice in
the W3C specs and compare node names (and tag names too for that
matter) using lower case:

if (node.nodeName && node.nodeName.t oLowerCase() == 'tr' ){
/* found an HTML TR node */
}
[...]
var, it chokes. Works fine on Moz (surprise, surprise). Any ideas?
Not really a surprise that it works in Mozilla, which has much better
support for DOM 3 than IE.

What you are seeing is likely a bug in IE that it doesn't correctly
assign a value to 'parent' - since it never finds the TR element, it
should be assigned 'null' (maybe you are using IE 7 and it does support
it, I dunno).
--
Rob

Aug 9 '06 #2
Holy geez. That's the most complete and helpful response to a post
I've ever had. Thanks for your help Rob. Now i'm going to go sulk in
the corner and read the standards again ;)

Aug 9 '06 #3

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

Similar topics

0
3285
by: NotGiven | last post by:
The code below is overwriting istself. I think it might be that I have to appedn it to the dom each loop. What it is doing is creating the fiels correctly the first time through. Then it over writes those same field again and again. I can tell because the value of the first field changes every loop. Any ideas?
3
1934
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
1894
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 get the ParentNode
5
6218
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
8260
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
5797
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 - find the <ato toggle visibility again - doesn't work in IE. Here's the relevant part of the script:
2
15822
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 node nested within a whole bunch of other div nodes in the DOM, the parentNode property evaluates...
7
37906
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 like "this.parentNode.childNodes.style.display="none", or "block" to display a menu below it. The...
2
8119
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; } can anybody tell me what is the error ?
0
9690
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
9550
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
10501
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
10273
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...
0
10032
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
9085
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
6811
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();...
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2944
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.