tg****@gmail.com wrote:
Matt,
You were exacly right. IE has a different parentNode than Firefox.
What a POS - I am really starting to hate javascript because of these
issues.
Don't blame JavaScript, it is just a scripting language - your issue
is with the different way various browsers implement the DOM.
It is often risky to depend on parentNode/childNode relationships and
frequently search or iterative techniques are required to ensure the
'correct' descendant/ancestor is recognised, e.g.
<table>
<tr>
<td onclick="alert(this.parentNode.parentNode)">click me</td>
</tr>
</table>
Will report 'TBODY', not 'TABLE'. If the table was the target, it
may be better to use a function that goes up the parents until the
table is found.
Try this in Firefox and then IE:
<script type="text/javascript">
function doClick(x){
var s = x.nextSibling;
alert('nextSibling is : ' + ((s)? s.nodeName : 'nothing' ));
}
</script>
<ul>
<li onclick="doClick(this)">click me</li>
<li onclick="doClick(this)">click me</li>
</ul>
Try posting a bit of the HTML you are having trouble with.
--
Rob