document.location和document.location.href有什么区别? <script language="JavaScript"><!-- a=document.location; b=document.location.href alert(a); alert(b);//--></script> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 location是对象 href 是location的属性当一个 Location 对象被转换成字符串,href 属性的值被返回。这意味着你可以使用表达式 location 来替代 location.href。 我的理解是这样的,第B是A的一个属性。A还可以调用其他的,如host、hostname等。 window.location 包含 href 属性,直接取值赋值时相当于 window.location.href。 window.location.href 当前页面完整 URL。 document.location; document.location.href location 应用于 window 和 document,同属于2个DOM下的对象,2者没有本质区别 window.location.replace("http://g.cn");window.location.href.replace("http://g.cn");执行一下你就知道了。alert(typeof window.location) // objectalert(typeof window.location.href) // string 求类似于淘宝搜索选项卡的弹出窗口插件。 js链接外部网址,能不能设置一个链接的时间,超过这个时间,就不再等待! 求JS 读出XML 新手求教:document.forms[0].entry.value什么意思 生成树状动态结构 |zyciis| 如何将一个JS文件做成对像形式如 Myjs.Find() 在线等待----表单的事件 关于页面控制 这个代码里按回车的时候为什么总是有从主板发声? 小白提问:关于JSP文件放置的问题 慎用innerHTML!动态添加内容的速度比较(顺便散50分) 如何在javascript中判断文本框中的日期不能大于当前日期吗?
href 是location的属性当一个 Location 对象被转换成字符串,href 属性的值被返回。这意味着你可以使用表达式 location 来替代 location.href。
A还可以调用其他的,如host、hostname等。
window.location.href 当前页面完整 URL。
document.location;
document.location.href location 应用于 window 和 document,同属于2个DOM下的对象,2者没有本质区别
alert(typeof window.location) // object
alert(typeof window.location.href) // string