JavaScript中的对象及层级关系、常用函数

来源:互联网 发布:网络英语考试时间 编辑:程序博客网 时间:2024/06/09 18:51
window是整个JavaScript的超全局变量,任何全局变量和全局函数都可以通过window点出。
 例如:window.myName,myName是我们自己定义的一个全局变量。

1、 window 【object Window】

1.1   window.document                             【object HTMLDocument】
      window.document.documentElement 【object HTMLHtmlElement】
      window.document.head                    【object HTMLHeadElement】
      window.document.body                      【object HTMLBodyElement】
      window.document.title                        【直接就是标题的文本内容】
      window.document.domain                  【直接就是加载文档的域名】
      window.document.createAttribute      【function】
      window.document.createTextNode    【function】

1.2   window.location      【Object Location 或 加载当前文档的URL】
      window.location.href
      window.location.reload(boolean)
      window.location.replace()
      window.location.host
      window.location.pathname
      
1.3   window.history       【object History】
      window.history.back()
      window.history.go(number)
      window.history.forward()

1.4  window.screen        【object Screen】

1.5  window.navigator     【object Navigator】

1.6  window.弹窗 alert()、confirm()、prompt()      【function】

1.7  window.计时器 setTimeout()、setInterval()     【function】

1.8  window.Math  【Object】

1.9 、Number、String、Date、Array、Boolean、RegExp    【都是构造函数,可以使用new来创建对应的对象】

其他常用:
typeof xxx; // 检测xxx是什么类型,例如Number或String     【关键字】

isNaN(yyy ) // 检测yyy是否为数字类型,结果是Boolean类型  【function】


0 0
原创粉丝点击