码迷,mamicode.com
首页 > Web开发 > 详细

js回归之BOM

时间:2015-10-24 15:46:25      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:

WINDOW:
================================================
窗口页面区域宽高
var w=window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; var h=window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;

屏幕可用宽高screen.availWidth,availHeight
URLlocation:

Window Location

window.location 对象在编写时可不使用 window 这个前缀。

一些例子:

  • location.hostname 返回 web 主机的域名
  • location.pathname 返回当前页面的路径和文件名
  • location.port 返回 web 主机的端口 (80 或 443)
  • location.protocol 返回所使用的 web 协议(http:// 或 https://)
  • location.href 返回url
  • location.assign() 方法加载新的文档

history:

  • history.back() - 与在浏览器点击后退按钮相同
  • history.forward() - 与在浏览器中点击按钮向前相同

navigator:具有误导性的特质,我们暂且不管他

消息框:

alert() 提示框

confirm(T/F)

prompt(value/null)

计时器:

这也是面试基本都会问到的基础题

setTimeout clearTimeout 

特征:在未来某时调用一次

如果要玄幻,就要不断调用自己

js回归之BOM

标签:

原文地址:http://www.cnblogs.com/belongcai/p/4906855.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!