标签:全局 version 浏览器 修改 nav mil 名称 用户 protoc
window全局作用域,而且表示浏览器窗口
window对象有innerWidth和innerHeight属性,网页净宽高(调整窗口值会变)
兼容性:IE<=8不支持
outerWidth和outerHeight属性,可获取浏览器窗口的整个宽高
navigator表示浏览器信息
navigator.appName:浏览器名称;
navigator.appVersion:浏览器版本;
navigator.language:浏览器设置语言;
navigator.platform:操作系统类型;
navigator.userAgent:浏览器设定的User-Agent字符串;
信息可以被用户修改
var width = window.innerWidth || document.body.clientWidth;
screen.width/height/colorDepth 返回屏幕宽/高/颜色位数
location对象表示当前页面的URL信息
可以通过location.href获取。也可以获得URL各个部分的值
location.protocol; // ‘http‘ location.host; // ‘www.example.com‘ location.port; // ‘8080‘ location.pathname; // ‘/path/index.html‘ location.search; // ‘?a=!&b=2‘ location.hash; // ‘TOP‘
location.assign()加载一个新页面。
location。reload()重新加载当前页
if (confirm(‘重新加载当前页‘ + location.href + ‘?‘)) { location.reload(); } else { location.assign(‘/discuss‘); // 设置一个新的URL地址 }
document整个DOM的根节点
document.title = ‘努力学习JavaScript!‘;可以更改文档标题
标签:全局 version 浏览器 修改 nav mil 名称 用户 protoc
原文地址:http://www.cnblogs.com/mudeng-007/p/6398701.html