There is a website that I would like to add links to but first it has to grab a link already in the page that contains an ID varible that is usually a 4 number digit. Note I am using greasemonkey...
Here is what I have...
BUT this doesnt seem to work...Code:var links = document.getElementsByTagName('a'); for (var i = 0; i < links.length; ++i) { var linkNode = links[i]; if(linkNode.href.match('http://domain.com/audiosample.aspx?songid=*')){ var result = linkNode.href; // split the url var array = result.split("="); var id = array[array.length-1]; if(id != ""){ // make link to project homepage var hp = document.createElement('A'); hp.setAttribute('href', 'http://domain.com/download.aspx?songid='+ id); hp.appendChild(document.createTextNode(' [Download Here]')); // not sure if this is the best way to do it linkNode.parentNode.insertBefore(hp, linkNode.nextSibling); //linkNode.parentNode.appendChild(hp); // not good } } }
EDIT>> NEVER MIND I GUESS JS DOESNT LIKE SPLITTING WITH "="...



Reply With Quote
Bookmarks