location对象

表示网页网址对象:

属性:

alert(location);

alert(location.protocol);//协议

alert(location.hostname);//主机名

alert(location.port);//端口

alert(location.pathname);//路径名

alert(location.search);//参数区

方法:

//            location.href = "2.html";//跳转到新网页

//            location.assign("2.html");//跳转到新网页

location.replace("2.html");、

你可能感兴趣的:(location对象)