2

js获取basePath

js获取基本地址

var curPath = window.document.location.href;
var PERFIX;
PERFIX = curPath.substring(0,curPath.indexOf("web"));

1、document表示的是一个文档对象,window表示的是一个窗口对象,一个窗口下可以有多个文档对象。

  所以一个窗口下只有一个window.location.href,但是可能有多个document.URL、document.location.href

2、window.location.href和document.location.href可以被赋值,然后跳转到其它页面,document.URL只能读不能写

posted @ 2020-09-29 16:33  浮夕  阅读(555)  评论(0编辑  收藏  举报