地址栏上#及后面的内容
console.log(window.location.hash);
主机名及端口号
console.log(window.location.host);
主机名
console.log(window.location.hostname);
文件的路径—相对路径
console.log(window.location.pathname);
端口号
console.log(window.location.port);
协议
console.log(window.location.protocol);
搜索的内容
console.log(window.location.search);
window.history.forward(); 前进上一个网页
window.history.back();后退到前一个网页
window.history.go(value); 正值前进 负值后退
window.navigator.userAgent
通过userAgent可以判断用户浏览器的类型
window.navigator.platform
通过platform可以判断浏览器所在的系统平台类型.
定时器:
该定时器会返回自己的id值
var timeId=window.setInterval(函数,时间);
执行过程:页面加载完毕后,过了一段时间执行函数,反复的,除非清理定时器
window.clearInterval(定时器的id值);清理定时器
var timeId= window.setTimeout(函数,时间);这是一次性的计时器
clearTimeout(timeId);不清理只会占内存 对界面没有影响