js css html 基础小结
//引入js
<script src="/statics/js/lujing/aa/add.js"></script>
//在这个js加载的时候 就执行的jquery函数
$(function () {
});
//js函数定义
function 函数名字() {
}
//根据class 样式 进行遍历 还有疑问
$('.父元素样式 .子元素样式').each(function () {
//获取元素的属性加入数组
customerArray.push({
高: $(this).height(),
宽: $(this).width()
});
}
//js请求$.ajax({
url: '../../xxx/xxx/' + $("#xxx").val(),
type: "POST",
contentType: 'application/json;charset=utf-8', //设置请求头信息
dataType: "json",
data: JSON.stringify(customerArray), //将Json对象序列化成Json字符串,JSON.stringify()原生态方法
success: function (data) {
},
error: function (res) {
alert(res.responseText);
}
});
学会了网页的断点调试,在js中加debugger,查看请求体和返回体在 以上 url url: '../../xxx/xxx/' + $("#xxx").val(),
这个拼接在后面 拿到的元素值
在JAVA后台接收不能用传统的resposebody接收,要以
@RequestMapping("/demo/{xxx}")
public Result update(@RequestBody List<Test> views,@PathVariable String xxx) {
引入css
<link rel="stylesheet" href="/statics/css/support-aaa.css">
定义一个按钮的css样式,一个div包裹一个button类型的input div#butt input {
background: #4cae4c;
color: #fff;
width: 300px;
height: 40px;
font: 14px Verdana, Arial, Helvetica, sans-serif;
}
//我的理解就类似android的style 定义之后可以复用
.container-fluid-plus {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
text-align: center;
}
//同上是一个表单的form
.form {
width: 100%;
margin: 0px;
padding: 0px;
margin-top: 20px;
border-collapse: collapse;
border-width: 3px 1px 1px;
table-layout: fixed;
text-align: left;
}
//定义当前界面的元素的css ,比如下面这个 应该就是所有的select都应用这个css
select {
font-family: inherit;
font-size: inherit;
line-height: inherit;
width:150px;
height: 30px;
}
还学会了可以在chrome中F12 审查元素,点击这个元素 或者它的父元素,在右侧可以实时的调整样式如果是一些源码中提供的样式不知道怎么改,就在游览器中找到这个css复制下来,改个名字调整后单独引入这个css