473,526 Members | 2,732 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IE equivalent of Firefox document.evaluate()

i've got this in firefox and it works

var xpath_result = document.evaluate("id('main')/tbody", document, null,
XPathResult.FIRST_ORDERED_NODE_TYPE, null );
var table = xpath_result.singleNodeValue;

what's the IE equivalent of it.

thx.


Aug 28 '06 #1
1 17323


ppcguy wrote:
i've got this in firefox and it works

var xpath_result = document.evaluate("id('main')/tbody", document, null,
XPathResult.FIRST_ORDERED_NODE_TYPE, null );
var table = xpath_result.singleNodeValue;

what's the IE equivalent of it.
It depends, if your document is an XML DOM document like IE gives you
with XMLHTTP as responseXML then you can do XPath queries with
selectNodes and selectSingleNode e.g.
var tbody = xmlDocument.selectSingleNode("id('main')/tbody");

If your document is a HTML document rendered in IE then there is no
XPath support (respectively no support for XPath over HTML).

That simply example however can be done with the Core and HTML DOM e.g.
var tableBody = document.getElementById('main').tBodies[0];
so I am not sure why you use XPath at all if that is an HTML document.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 29 '06 #2

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

Similar topics

4
2063
by: Kim14 | last post by:
I have a table that works fine in IE, but doesn't work in Netscape or Firefox. It should automatically come up with numbers in some of the fields and depending what is entered, it should calculate and come up with a dollar amount. If anyone out there sees what I am doing wrong- could you offer some advice? I apologize in advance for...
3
18550
by: Iain Hallam | last post by:
Hi. I've been using display:none on the style property of some <option> elements in my forms, which works fine with Mozilla - as expected it removes the option from my dropdown (although it still exists in the code). Is there an equivalent in IE? The reasoning behind this is that I want users to rank objects using a <select> for each...
7
26974
by: Mark Szlazak | last post by:
Is there anything for Mozilla or Firefox that would be equivalent to IE's onpaste event for a textarea?
8
5622
by: Dominic Tocci | last post by:
I'm searching for a way to use window.open on my web page to open a window in firefox that allows the sidebars to work (bookmarks, history, etc). When I use the following: var popWindow=window.open('http://www.yahoo.com','','width=600,height=400,toolbar=1,location=1,menubar=1,resizable=1,titlebar=1,directories=1,status=1,scrollbars=1'); the...
15
19852
by: Dan | last post by:
Hi. I've got the following line of code which works fine in IE ... line_1_numbers = document.getElementsByTagName ('table').rows (0).cells (0).innerText; But it Firefox, it barks saying: "Error: document.getElementsByTagName("table").rows is not a function"
4
2009
by: Laurent Compere | last post by:
Hi all, I try to make a logo fade in. I wrote the code below that is simple and supposed to be compatible with IE6,Firefox and Netscape. It works pretty well under IE6 but under Firefox and Netscape, I have the same problem : It seems that the property MozOpacity doesn't want to update itself though I cand read its value with the same...
2
1259
by: Trillium | last post by:
This seems like it should be really easy, but I cannot seem to make it work. I am trying to retrieve the text value of an element named "child2Element" from an XML file in a .NET (v 1.1) with an XPath expression. In an XSLT document I would use <xsl:value-of select="rootElement/child1Element/child2Element"/> (and this does work fine in a...
4
7452
by: evgenyg | last post by:
Hello ! We have the following situation - when Ajax request is sent what's being returned by the server is usually an XML (which is used for DOM updates) but sometimes it's HTML which is a whole new page that should replace an existing one. I.e when we issue an Ajax request we don't know what will be returned and analyze the response to act...
2
7356
by: Björn Langhof | last post by:
Hello. I want to evaluate a XPath-Expression only on a subtree of the whole xml-document. 1. I select a node of the XML-document 2. Then a want to select specific nodes below the node chosen in 1. I thought the parameter contextNode in var xpathResult = document.evaluate(xpathExpression, contextNode,
0
7328
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
7474
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
7646
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
7600
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...
0
5776
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
3310
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
3310
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1700
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
887
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.