1. 返回当前日期的星期一和星期日的日期 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 var  now = new  Date ();var  nowTime = now.getTime ();var  day = now.getDay ();var  oneDayTime = 24 *60 *60 *1000 ;var  MondayTime  = nowTime - (day-1 )*oneDayTime;var  SundayTime  = nowTime + (7 -day)*oneDayTime;var  monday = new  Data (MondayTime );var  sunday = new  Date (SundayTime );function  add0 (m ){return  m<10 ?'0' +m :m }function  format (shijianchuo ){ 	 	var  time = new  Date (shijianchuo); 	var  y = time.getFullYear (); 	var  m = time.getMonth ()+1 ; 	var  d = time.getDate (); 	 	 	 	return  y+'' +add0 (m)+'' +add0 (d); 	 } console .log (format (monday)); console .log (format (sunday));
2. 缩放页面不影响布局的方法 在布局时最外面套一层div,给这个div赋一个固定的长度
CSS代码
1 2 3 4 5 6 #main {    width :xxxxpx;     height :xxxxpx;     MARGIN-RIGHT : auto; 	MARGIN-LEFT : auto; } 
3. 点击按钮添加新的盒子 JavaScript代码
1 2 3 4 5 6 7 box0.onclick  = function  addDiv (     var  div = document .createElement ('div' );     faetherbox.insertBefore (div,fatherbox.children [0 ]);         div.className  = '······' ;     div.innerHTML  = '···' ;     document .body .appendChild (div); } 
4. 创建标签 追加标签 
创建标签 
 
1 var  tag = document .creatElement ('li' );
添加标签内容 
 
追加标签 
 
parentNode.appendChildren(tag);追加在a的父级的最底部,而且a和tag都是同一个父级
parentNode.insertBefore(tag,a);追加在a的前面,a和tag都是同一个父级
 
获取input的值 
 
1 2 <input  id ='txt'  value ='' > var name = txt.value 
改变input标签文本的内容 
 
5. 获取当前时间 1 2 3 4 5 6 7 8 var  date = new  Date ();var  year = date.getFullYear ();var  month = date.getMonth () + 1 ;var  dates = date.getDate ();year = year < 10  ? '0'  + year : year; month = month < 10  ? '0'  + month : month; dates = dates < 10  ? '0'  + dates : dates; time.innerHTML  = year + '-'  + month + '-'  + dates; 
6. 自定义select框的值并选中值 
1 2 3 4 5 <select  id ="select" >     <option  value ="1" > 可选值1</option >      <option  value ="2" > 可选值2</option >      ... </select > 
1 2 3 4 5 var  selects = document .getElementById ('select' );onchange = function (     var  indexs = selects.selectedIndex ;        console .log (selects.options [indexs].value ); } 
7. 提示框遮罩页面 
1 2 3 4 5 6 7 8 9 <div  id ="popLayer" > </div > <div  id ="popBox" > 	<div  class ="content" >      </div >      <div  class ="close" >      	<button  class ="button1"  οnclick ="closeBox()" > 是</button >          <button  class ="button2"  οnclick ="closeBox()" > 否</button >      </div >  </div > 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 #popLayer  {    height : 100% ;     display : none;     background-color : #212020 ;     position : fixed;     top : 0 ;     right : 0 ;     bottom : 0 ;     left : 0 ;     z-index : 10 ;     -moz-opacity : 0.8 ;     opacity : .80 ;     filter : alpha (opacity=80 ); } #popBox  {    display : none;     background-color : #d9d9d9 ;     z-index : 11 ;     width : 300px ;     height : 100px ;     border-radius : 10px ;     position : fixed;     top : 0 ;     right : 0 ;     left : 0 ;     bottom : 0 ;     margin : auto; } .content  {    font-size : 17px ;     padding-left : 36px ;     padding-top : 15px ;     line-height : 22px ;     font-weight : 500 ; } .close  .button1  {    display : inline-block;     width : 25px ;     height : 25px ;     margin-left : 80px ;     margin-top : 5px ;     border-radius : 4px ;     border : white; } .close  .button2  {    display : inline-block;     width : 25px ;     height : 25px ;     margin-left : 80px ;     margin-top : 4px ;     border-radius : 4px ;     border : white; } 
8. axios发送post请求和get请求的具体用法 html写入代码
1 2 3 <head >     <script  src ="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js" > </script >  </head > 
js文件中
1 2 3 4 5 6 7 8 9 10 11 12 13 14 axios.default .baseURL  = '....' ; axios ({    url :'.../...' ,     method :'GET' ,     contentType :'application/json' ,     headers :{         'Content-Type' : 'application/x-www-form-urlencoded'      },     params :{         xxx :'...' ,     } }).then (function (data ){         console .log (data.data );         }) 
+ 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 axios ({    url :'...' ,     method :"POST" ,     contentType :"application/json" ,     headers :{         'contentType' :'application/x-www-form-urlencoded'      },     data :{         xxx :'...' ,         xxx :'...' ,     } }).then (function (result ){     console .log (result.result ); }) 
9. Cookie、Session和Token 这部分会作为重点单独总结
10. flex布局 flex布局语法 
flex用法案例一 
flex用法案例二 
11. 跨页面传参 
使用window.open()传参 
使用window.location将要传递的数据放在跳转到页面的请求头里,从请求头获取数据 
 
具体使用方法案例 
12. 页面布局的稳定性 
标记的重要性 
用合适的标签 
保证页面布局不随窗口大小而改变相对位置 
正确使用padding和margin 
标准流、浮动流和定位流的稳定性 
 
能用标准不用浮动,能用浮动不用定位