I am attempting to build some logic based on the referring information containing a particula domain name. This is easy enough when I am only looking for one domain, but I have been asked to include multiple domains that may be a match. Once I attempt to use more than one domain, the whole things falls apart. In these examples, if I use "abc" to test, it works correctly and placeHolder is set to One. If I change it to "def" or any other string, I get "None" as the value.
Any guidance would be greatly appreciated.
Sample of the code I am using:
I have also tried using something like this in the indexof, but it doesn't work either.
Any guidance would be greatly appreciated.
Sample of the code I am using:
Code:
<script language="javascript">
var myRef=new Array("abc","def","ghi","jkl","mno","pqr","stu","vwx","yzz");
</script>
<SCRIPT LANGUAGE="JavaScript">
if(document.referer.indexOf(myRef) != -1){
placeHolder = "One";
} else {
placeHolder = "None";
}
</SCRIPT>
Code:
<SCRIPT LANGUAGE="JavaScript">
if(document.referrer.indexOf("abc"||"def"||"ghi"||"jkl"||"mno"||"pqr"||"stu"||"vwx"||"yzz") != -1){
placeHolder = "One";
} else {
placeHolder = "None";
}
</SCRIPT>