Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
This line is the error:
Code:
if !(document.links[i].href.IndexOf('google') > 0)
If there's going to be negation (!), it needs to be INSIDE the IF parenthesis (), not outside of it. However, there's never a need for negation in a <, >, <=, or => comparison, since you can just use another operator ( <= is the opposite of >, for example).
In this case you can just remove it, since what you want is to find google at an indexOf greater than 0.
Have you thought that this logic isn't very solid in its application, even if you make it work as I describe? After all, it would do that operation on ANY link containing the text 'google', which might cause unexpected results if any other website every contains a reference to google anywhere in the site name or the path.
__________________
I build web things. I work for the startup Please login or register to view this content. Registration is FREE
.
|