===
何时使用==
? 强制类型转换<a>
标签,点击的时候弹出来对应的序号 作用域几种基本数据类型?复杂数据类型?值类型和引用数据类型?堆栈数据结构?
对象是一个无序的“‘名称/值’对”集合。一个对象以“{”(左括号)开始,“}”(右括号)结束。每个“名称”后跟一个“:”(冒号);“‘名称/值’ 对”之间使用“,”(逗号)分隔。
object instanceof constructor
instanceof 运算符用来检测 constructor.prototype 是否存在于参数 object 的原型链上。
var a={}
其实是var a=new Object()
的语法糖var a=[]
其实是var a=new Array()
的语法糖function Foo(){..}
其实是var Foo=new Function(..)
var item for (item in f) { if (f.hasOwnProperty(item)) { console.log(item) } }
事件委托就是利用事件冒泡,只指定一个事件处理程序,就可以管理某一类型的所有事件。
题目:假设高度已知,请写出三栏布局,其中左栏、右栏宽度各为300px,中间自适应
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> *{ padding: 0; margin:0; } .layout article div{ min-height: 100px; text-align: center; } </style> </head> <body> <section class="layout float"> <style meida="screen"> .layout.float .left{ float: left; width:300px; background-color: #5F5F5F; } .layout.float .right{ float: right; width:300px; background-color: #5F5F5F; } .layout.float .center{ background-color: #E0E0E0; } </style> <article class="left-right-center"> <div class="left"></div> <div class="right"></div> <div class="center"> <h1>浮动解决:脱离文档流,兼容比较好,增加高度溢出,无法使用</h1> </div> </article> </section> <section class="layout absolute"> <style type="text/css"> .layout.absolute .left-center-right>div{ position: absolute; } .layout.absolute .left{ left:0; width: 300px; background-color: #FFC3C3; } .layout.absolute .center{ left:300px; right: 300px; background-color: yellow; } .layout.absolute .right{ right: 0px; width: 300px; background-color: #A8F2E2; } </style> <article class="left-center-right"> <div class="left"></div> <div class="center">绝对定位,下面的元素都要脱离文档流,超出</div> <div class="right"></div> </article> </section> <section class="layout flexbox"> <style type="text/css"> .layout.flexbox{ margin-top: 100px; } .layout.flexbox .left-center-right{ display: flex; } .layout.flexbox .left{ width:300px; background-color: #A2EFAA; } .layout.flexbox .center{ flex: 1; background-color: #F8E0A1; } .layout.flexbox .right{ width:300px; background-color: #A2EFAA; } </style> <article class="left-center-right"> <div class="left"></div> <div class="center">flex</div> <div class="right"></div> </article> </section> <section class="layout table"> <style type="text/css"> .layout.table .left-center-right{ width: 100%; display: table; height: 100px; } .layout.table .left-center-right>div{ display: table-cell; } .layout.table .left{ width: 300px; background-color: red; } .layout.table .center{ background-color: blue; } .layout.table .right{ width: 300px; background-color: yellow; } </style> <article class="left-center-right"> <div class="left"></div> <div class="center">表格:需要同时增高</div> <div class="right"></div> </article> </section> <section class="layout grid"> <style type="text/css"> .layout.grid .left-center-right{ display: grid; width: 100%; grid-template-rows:100px; grid-template-columns:300px auto 300px; } .layout.grid .left{ background-color: yellow; } .layout.grid .right{ background-color:blue ; } .layout.grid .center{ background-color: red; } </style> <article class="left-center-right"> <div class="left"></div> <div class="center">网格布局,超出高度无法使用</div> <div class="right"></div> </article> </section> </body> </html>