I have an if statement, as seen below.
if (l*.href.split('/')[2].replace(/www\./, '') != document.domain.replace(/www\./, '')
&& !l*.getAttribute('target')
&& !l*.parentNode.id.match(/^copy/)
&& l*.href.indexOf(your_domain) == -1) {
//etc, etc
}
This works ok. But as soon as I change the last “and” (&&) to an “or” (||), there is a problem.
if (l*.href.split('/')[2].replace(/www\./, '') != document.domain.replace(/www\./, '')
&& !l*.getAttribute('target')
&& !l*.parentNode.id.match(/^copy/)
|| l*.href.indexOf(your_domain) == -1) {
//etc, etc
}
This if statement is encased in a for loop, and with the “or” there, the loop just keeps on going, as if there is something not closed properly.
Can anyone see a problem with the second piece of code above and why it doesn’t work when the first one does? Is there something else I can add in to get this working as it should?
Thanks in advance