Html5前端:
3,Js(javascript):交互师,让页面动起来
a,变量定义
(c) int a=8;
(js) variable变量
vara=8;
var a=8.8;
b,函数定义
1,返回值类型
2,函数名sum 是一个变量 存放当前函数地址的变量
3,形参列表(无值)
4,{}函数体 程序块
5,返回值
(c) int sum(int a,int b){
retuen a+b;
}
函数调用
a=sum(1,2)
(js)
function sum(a,b)
{
return a+b;
}
var sum1=function(a,b)
{
return a+b;
}
sum1(3,5);
function hehe(callback,b){
return callback(5,6)+b;
}
hehe(sum,5);
函数调用
alert(sum(1,2))
alert(sum("a","b"))
带一个箭头的箭头参数:
(a) => {
return a;
}
a =>{
return a;
}
(a,b) =>{
retuen a+b;
}
function hehe (a,b){
return a+b;
}
4,适配:
5,接口文档
1, 服务器地址(http//:)用来区分不同公司
2, 子url:/aboutus, 用来区分不同接口,让不同页面得到自己页面想要的数据
3, 请求方式:
http: 短连接 客户端 服务端 (需要多次发送请求)
tcp/ip: 长连接
udp: 网游
get:
1, 把传输的数据放到了浏览器的地址栏里
2, 不安全
3, 传输的数据量少
post:
1, 把传输的数据封装到了form表单里
2, 安全
3, 传输的数据量比较大
4, 参数:username pwd
5, 响应:json
{
"code" : 1, // 0失败 1成功
"msg" :"获取数据成功"
"data" : {}
}
6,css 边距:
外边距:
margin:
margin:10px;
margin:10px 20px;
margin:10px 20px 30px 40px; /上右下左(顺时针)
margin-top
margin-right
margin-bottom
margin-left
内边距:
padding:
7,定位:
固定定位:
步骤:
1.找坐标: x:leftright
y:topbottom
2.加螺丝钉:
possition:fixed;
注意:
遮挡
大小
绝对定位:
步骤:
1,先设置外部大盒子为参照物 position: relative
2,找坐标 X:left right Y:top bottom
3,定位 position: absolute
注意:
会改变层次关系
解决:
z-
8,标签分类(性别)
块级标签(男):可设置宽高,独立成行 p div display:block
内联标签(女):不可设置宽高(宽高由内容决定),不独立成行 span display:inline
内联块级标签(人妖):可以设置宽高,不独立成行 img display: inline-block
9, 线程 (主线程 子线程)
进程