<script language="JavaScript">
<!--
a=document.location;
b=document.location.href
alert(a);
alert(b);
//-->
</script>

解决方案 »

  1.   

    location是对象 
    href 是location的属性当一个 Location 对象被转换成字符串,href 属性的值被返回。这意味着你可以使用表达式 location 来替代 location.href。
      

  2.   

    我的理解是这样的,第B是A的一个属性。
    A还可以调用其他的,如host、hostname等。
      

  3.   

    window.location 包含 href 属性,直接取值赋值时相当于 window.location.href。 
    window.location.href 当前页面完整 URL。 
    document.location; 
    document.location.href location 应用于 window 和 document,同属于2个DOM下的对象,2者没有本质区别
      

  4.   

    window.location.replace("http://g.cn");window.location.href.replace("http://g.cn");执行一下你就知道了。
    alert(typeof window.location) // object
    alert(typeof window.location.href) // string