代码1:
<script type="text/javascript"> if(self!=top){top.location=self.location;} var ref=document.referrer; var domains=new array("jb200.com/","jbxue.cn/","jb200.com.cn/"); var refpass=false; for(i=0;i<=domains.length;i++){if(ref.indexof(domains[i])>0){refpass=true;break;}} if(ref==""){refpass=true} if(!refpass){window.location.href='http://www.jb200.com';} </script>
代码2:
<script type="text/javascript">
function gotourl()
{
var url = "http://www.jb200.com";
var localurl = document.url;
if( localurl.substring(0,url.length) != url )
{
location.href=url;
}
}
gotourl();
</script>
以上就是本节javascript 教程为大家提供的二个小代码,判断当前网址来路,并实现了页面的跳转。