Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Simple IE xpath help

Reply
Thread Tools

Simple IE xpath help

 
 
eggie5@gmail.com
Guest
Posts: n/a
 
      01-23-2007
I know how to edit my page using xpath selectors in firefox, it's just
like this (in the else if). However, I can't find any way to do it in
IE? I just want to find all links with the className=='leftNavPElement'
and then set them to 'leftNavBltItem', but I can't find how to do the
xpath stuff in IE. Can somebody please fill in the if statment ie code
for me?

if (window.ActiveXObject)
{

//how do I do the code below for IE???
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation &&
document.implementation.createDocument)
{
try
{
var layers =
document.evaluate('//a[@class="leftNavPElement"]', document, null,
XPathResult.ANY_TYPE, null );

var thisLayer = layers.iterateNext();


while (thisLayer) {

thisLayer.className="leftNavBltItem";
thisLayer = layers.iterateNext();


}

}
catch(exception)
{
//this try catch is required for the
leftnav to work for some reason....
}
}
else
{
alert('errors in breadcrums.js line: 104');
}

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      01-23-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> I know how to edit my page using xpath selectors in firefox, it's just
> like this (in the else if). However, I can't find any way to do it in
> IE? I just want to find all links with the className=='leftNavPElement'
> and then set them to 'leftNavBltItem', but I can't find how to do the
> xpath stuff in IE.


Mozilla and Opera 9 support XPath over HTML DOM documents, IE does not
do that. If you want to find all a elements with a certain className
value then loop over document.getElementsByTagName('a') and check the
className property in the loop.


--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
eggie5@gmail.com
Guest
Posts: n/a
 
      01-25-2007
Thanks, don't know why I couldn't find that documented anywhere....

On Jan 23, 5:10 am, Martin Honnen <(E-Mail Removed)> wrote:
> (E-Mail Removed) wrote:
> > I know how to edit my page using xpath selectors in firefox, it's just
> > like this (in the else if). However, I can't find any way to do it in
> > IE? I just want to find all links with the className=='leftNavPElement'
> > and then set them to 'leftNavBltItem', but I can't find how to do the
> > xpath stuff in IE.Mozilla and Opera 9 support XPath over HTML DOM documents, IE does not

> do that. If you want to find all a elements with a certain className
> value then loop over document.getElementsByTagName('a') and check the
> className property in the loop.
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Memory leak" in javax.xml.xpath.XPath Marvin_123456 Java 4 07-29-2005 03:49 PM
XPath: efficiency in xpath expressions Tjerk Wolterink XML 1 11-13-2004 06:03 PM
Are there any XPath parsers that generate XPath trees? goog XML 0 01-14-2004 01:47 PM
XPath that does not include other XPath Anna XML 0 07-31-2003 07:55 AM
Problem selecting a node with XPATH if attribute value contains backslashes - how to force XPATH string to be treated as literal? Alastair Cameron XML 1 07-08-2003 07:24 PM



Advertisments