首页和栏目页用的是相同的网页模板,为了区分,想通过javascript 实现这样的功能:
当打开首页. 把id="box1" 的DIV层自动隐藏.
当url不是首页地址的时候, 把id="box2"的DIV层隐藏.例如.当url为http://www.abc.com/ 时,自动隐藏<DIV id="box1"></DIV> 标签内的页面内容.<DIV id="box2"></DIV> 正常显示.当url为http://www.abc.com/abc等,自动隐藏<DIV id="box2"></DIV> 标签内的页面内容.<DIV id="box1"></DIV> 正常显示. 
<html>
<body>
<div id="box1">
box1
</div>
<div id="box2">
box2
</div><script type="text/javascript">
function disPlay(){
  var b1 = document.getElementById("box1");
  var b2 = document.getElementById("box2");
  if(window.location.href = "http://www.abc.com/"){
      b1.style.display = "none";
      b2.style.display = "block"
  }
  else{
      b1.style.display = "block";
      b2.style.display = "none"
  }

</script>
</body>
</html>
二楼的,按上面的代码, 调试不出来啊,