window对象
window.alert()
window.confirm() 用户点击确定,返回true;用户点击取消,返回false
window.prompt() 用户输入后,点击确定,则返回用户输入的值,是字符串
window.open() 打开一个新的浏览器窗口,窗口的链接路径、属性参数都可以设置
window.close() 关闭当前窗口,注意不是子窗口
window.setTimeout(function(){},1000) window可省略,一般都不写window 意思是在XXX毫秒后,执行函数
clearTimeout(); 清除超时调用
window.setInterval(function(){},1000) window可省略,一般都不写 意思是每隔XX毫秒,就执行一次函数
clearIntercal(); 清除间歇调用
location对象
location.href 返回当前页面完整的url,也可以进行设置
location.hash 返回url中#及其后面的内容,也可以进行设置
location.host 返回服务器名称和端口号
location.pathname 返回url中的目录或文件名
location.protocol 返回页面使用的协议,是http还是https
location.search 返回url的查询字符串,也就是?号及其后面的内容
location.replace() 不会在历史记录中生成新记录
location.reload() 重新加载当前页面
history对象
history.back() 返回历史记录的上一步
history.forward() 返回历史记录的下一步
history.go(-1) 返回历史记录的上一步
history.go(-2) 返回历史记录的上两步
history.go(1) 返回历史记录的下一步
history.go(2) 返回历史记录的下两步
screen对象
screen.availWidth,注意没括号,获取显示屏幕的宽度
screen.availHeight,注意没括号,获取显示屏幕的高度
window.innerWidth,注意没括号,获取窗口文档显示区的宽度
window.innerHeight,注意没括号,获取窗口文档显示区的高度
navigator对象
navigator.userAgent 注意没括号
获取浏览器名称、版本、终端是移动端还是PC端、引擎以及操作系统等信息
|
|