This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1.浏览器对象模型 (BOM): | |
| 浏览器对象模型(Browser Object Model) | |
| BOM提供了独立于内容而与浏览器窗口进行交互的对象。 | |
| 由于BOM主要用于管理窗口与窗口之间的通讯,因此其核心对象是window | |
| BOM由一系列相关的对象构成,并且每个对象都提供了很多方法与属性 | |
| BOM缺乏标准,javaScript语法的标准化组织是ECMA,DOM的标准化组织是W3C | |
| 2.Window 对象: | |
| 所有浏览器都支持 window 对象。它表示浏览器窗口,是BOM的顶层(核心)对象,所有对象都是通过她延伸来的! | |
| 所有 JavaScript 全局对象、函数以及变量均自动成为 window 对象的成员。 | |
| 全局变量是 window 对象的属性。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 代码为: | |
| { | |
| // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| css里面的代码: | |
| ```language | |
| .box{ | |
| width: 300px; | |
| height: 500px; | |
| position: relative; | |
| margin: auto; | |
| } | |
| img{ | |
| width:100%; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1.Dom是什么? | |
| 当网页被加载时,浏览器会创建页面的文档对象模型(Document Object Model)。 | |
| DOM是“Document Object Model”(文档对象模型)的首字母缩写。 | |
| 2.DOM 节点: | |
| 在 HTML DOM 中,所有事物都是节点。DOM 是被视为节点树的 HTML。 | |
| HTML 文档中的所有内容都是节点: | |
| 整个文档是一个文档节点 document | |
| 每个 HTML 元素是元素节点 h1 | |
| HTML 元素内的文本是文本节点(包括空格) | |
| 每个 HTML 属性是属性节点 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1.getMinutes(): | |
| getMinutes() 方法可返回时间的分钟字段。 | |
| 返回值: dateObject 的分钟字段,以本地时间显示。返回值是 0 ~ 59 之间的一个整数。 | |
| 2.setMinutes(): | |
| setMinutes() 方法用于设置指定时间的分钟字段。 | |
| 语法: dateObject.setMinutes(min,sec,millisec) | |
| min 必需。表示分钟的数值,介于 0 ~ 59 之间,以本地时间计(下同)。 | |
| sec 可选。表示秒的数值,介于 0 ~ 59 之间。在 EMCAScript 标准化之前,不支持该参数。 | |
| millisec 可选。表示毫秒的数值,介于 0 ~ 999 之间。在 EMCAScript 标准化之前,不支持该参数。 | |
| 3.getSeconds(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1.getDate() : | |
| getDate() 方法可返回月份的某一天。 | |
| 返回值: dateObject 所指的月份中的某一天,使用本地时间。返回值是 1 ~ 31 之间的一个整数 | |
| : | |
| etTime() 方法以毫秒设置 Date 对象。 | |
| 语法: dateObject.setTime(millisec) | |
| eg: | |
| var d = new Date() | |
| d.setTime(77771564221) | |
| document.write(d) | |
| 2.getFullYear(): | |
| getFullYear() 方法可返回一个表示年份的 4 位数字。 | |
| 返回值 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1.日期对象创建: | |
| Date 对象用于处理日期和时间。 | |
| 通过 new 关键词来定义 Date 对象。 | |
| 注释:Date对象自动使用当前的日期和时间作为其初始值。 | |
| 2.toString(): | |
| toString() 方法可把 Date 对象转换为字符串,并返回结果。 | |
| var d = new Date() | |
| document.write (d.toString()) | |
| 3.toLocaleString(): | |
| toLocaleString() 方法可根据本地时间把 Date 对象转换为字符串,并返回结果。 |