Then I would like to walk the nodes and find an anchor that contains "seek/log" in it's href attribute.
Can that be done or is that a security violation and not permitted?
I load the winRef variable like this
Expand|Select|Wrap|Line Numbers
- winRef = window.open("http://www.otherSite.com" );
Expand|Select|Wrap|Line Numbers
- var rootnode=winRef.document.getElementById("Form1")
- var walker=winRef.document.createTreeWalker(rootnode, NodeFilter.SHOW_ELEMENT, myfilter, false)
Expand|Select|Wrap|Line Numbers
- var rootnode=winRef.getElementById("Form1")
- var walker=winRef.createTreeWalker(rootnode, NodeFilter.SHOW_ELEMENT, myfilter, false)
below is my tree walker code.
Expand|Select|Wrap|Line Numbers
- function walkTheNodes()
- {
- //var rootnode=document.getElementById("Form1")
- var rootnode=winRef.getElementById("Form1")
- var walker=document.createTreeWalker(rootnode, NodeFilter.SHOW_ELEMENT, myfilter, false)
- //Step through and alert all child nodes
- while (walker.nextNode())
- alert(walker.currentNode.tagName)
- var cHref = walker.currentNode;
- var cChk = walker.currentNode.href;
- var i = walker.currentNode.href.indexOf("seek/log");
- if ( i != -1 )
- {
- alert(walker.currentNode.href);
- }else{
- alert("Did not find");
- }
- //Go back to the first child node of the collection and alert it
- walker.currentNode=rootnode //reset TreeWalker pointer to point to root node
- }
- myfilter=function(node){
- if ( node.tagName=="A") //filter out INPUT
- return NodeFilter.FILTER_ACCEPT
- else
- return NodeFilter.FILTER_SKIP
- }