dFshadow All American 9507 Posts user info edit post |
i need a quick script for a forum in firefox that basically loads the page,
finds in the source of the page a URL with the words pid=000000 and returns whatever the string 000000 has in it and forms a button or link with a new modified URL using that number
how hard would that be? 3/12/2008 7:30:00 AM |
qntmfred retired 40726 Posts user info edit post |
very easy something to the effect of
var hyperlinks = document.getElementsByTagName('a'); for (var i = 0; i < hyperlinks.length; i++) { if (hyperlinks[i].href.match(/pid=(.*)/) != null) { var newlink = document.createElement('a'); newlink.href = 'http://somewebsite.com/index.php?pid=' + hyperlinks[i].href.match(/pid=(.*)/)[1]; newlink.innerHTML = 'link text'; document.getElementById('whereyouwanttoputit').appendChild(newlink); break; } }
[Edited on March 12, 2008 at 8:34 AM. Reason : ought to do it]3/12/2008 8:14:25 AM |