By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,712 Members | 2,111 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,712 IT Pros & Developers. It's quick & easy.

IE equivalent of Firefox document.evaluate()

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a


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 discussion thread is closed

Replies have been disabled for this discussion.