Add link for detail page
|
|
Hi Cody. Thank you so much for this script. it very handy & works like a charm. I was trying to add a link to the detail page for each search result. But the result isn't favourable.
I'm unable to achieve this & have given up after several attempts. I'd be glad if you could help me out here.
var all_pt = document.evaluate(
"//a[contains(@href,'/get/')]",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
for (var i = 0; i < all_pt.snapshotLength; i++) {
var el = all_pt.snapshotItem(i);
var id = el.href.substr(el.href.lastIndexOf('/')+1);
var imge = document.createElement('img');
imge.src = "/images/down.gif";
imge.class = "ti";
imge.style.float = "left";
imge.style.margin = ".3em";
var ae = document.createElement('a');
ae.href = "/det/" + id;
ae.appendChild(imge);
el.parentNode.appendChild(ae);
}
|