Saved Bookmarks
| 1. |
Solve : chnaging tags colours with specific search criteria? |
|
Answer» HI i am making a chrome extension and im done up to the most important part, that is to change the background and text colour of specific TAGS that have a certain phrase within them at the moment the tags are made like this (unchangeable): "name here" [/url] "phrase is here" [/url] "other stuff" [/url] what i need the script to do (javascript) is to search the WHOLE document for specific phrases / guild tags and if it finds one within the phrase area it changes its text and background colour swell as the other two table cells in that row, i have attempted this several times and have ultimately failed, i can change one item on the table and that is about it so far. any help on how i could do this would be great (there will be a couple of ARRAYS for the phrases one for allies, enemy's and do not hit.)ok i have made this: Code: [Select]var num=document.getElementsByTagName("a") var amo=num.length; for (i=0; i<amo; i++) { if (num[i].parentNode.parentNode.parentNode.parentNode.className=="layout listing btnlisting sorttable") { if (num[i].innerHTML.search('[Ebil]')>0) { alert(num[i].innerHTML); num[i].parentNode.style.background="#660000"; } } } the only problem is that it does not always work and it highlights some cells without '[Ebil]' being within the HTML of the a tag |
|