javascrip代码片断

替换A链接
<script type="text/javascript">
if (location.hostname=="esf1.soufun.com")
{
		var obj = document.getElementsByTagName("a");
		var myArray = ["esf.soufun.com","rent.soufun.com"];
		var reArray = ["esf1.soufun.com","rent1.soufun.com"];
		for(var j=0;j<obj.length;j++)
		{
		    for(var i=0;i<myArray.length;i++)
		    {
		      obj[j].href  = obj[j].href.replace(myArray[i],reArray[i]);
		    }
		}
}
</script>

不被iframe
 <script type="text/javascript" > if (self != top) top.location = self.location; </script> 
posted @ 2011-06-29 14:53  老皆知  阅读(168)  评论(0编辑  收藏  举报