让网页自动穿上外套

javascript

2009-04-14 11:07

<script>
if(top.location==self.location)
{
top.location="index.htm?"+self.location;
}
</script>

<script>
document.write('<iframe id="mid" name="mid" width="100%" height="100%" frameborder="0" scrolling="auto"')
var n=self.location.href.indexOf("?")//查看是否包含参数
if(n>0)//存在参数
{
//指向参数
document.write(" src="+self.location.href.substr(n+1))
}
document.write('></iframe>')
</script>