Created
August 31, 2012 12:14
-
-
Save necenzurat/3552021 to your computer and use it in GitHub Desktop.
Banner target on regions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script language="javascript" src="http://j.maxmind.com/app/geoip.js"></script> | |
<script language="javascript"> | |
// aici intra linku catre sait | |
link = "http://redtube.com"; | |
// aici intra imaginea | |
banner = "http://www.e-oferta.ro/openx/www/images/78004bd0f8cbf0e797e9ee811b8305d9.gif"; | |
// in ce judete sa fie afisat | |
locatii_de_afisat = ["Cluj","Bucuresti","Timis"]; | |
regiune = geoip_region_name(); | |
function findinarray(arr, obj) { | |
for(var i=0; i<arr.length; i++) { | |
if (arr[i] == obj) return true; | |
} | |
} | |
if (findinarray(locatii_de_afisat, regiune)){ | |
document.write("<a href="+ link +" rel='nofollow'><img src="+ banner +"></a>"); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment