<script>
var url = document.location.href;
if(url.indexOf("www.csdn.net")>-1){
alert("正确");
}else{
alert("不是www.csdn.net");
}
</script>

解决方案 »

  1.   

    var url = document.location.href;//是com站就调用key=1的,否则调用key=2的
    if(url.indexOf("www.csdn.net")>-1){
        document.write("<scr"+"ipt src="http://map.google.com/maps?file=api&amp;v=2&amp;key=1 </script>");
    }else{
        document.write("<scr"+"ipt src="http://map.google.com/maps?file=api&amp;v=2&amp;key=2 </script>");
    }抄楼上的