表单验证
<div class="jumbotron">
<div class="container">
<form action="" method="post" class="form">
<div class="form-group">
<label for="username">注册账户:</label><span class="error_tip">提示信息</span>
<input name="username" class="form-control" id="username" placeholder="注册账户">
</div>
<div class="form-group">
<label for="password1">密码:</label><span class="error_tip">提示信息</span>
<input name="password1" type="password" class="form-control" id="password1" placeholder="密码">
</div>
<div class="form-group">
<label for="password2">重复密码:</label><span class="error_tip">提示信息</span>
<input name="password2" type="password" class="form-control" id="password2" placeholder="重复密码">
</div>
<div class="form-group">
<label for="email">邮箱:</label><span class="error_tip">提示信息</span>
<input name="email" type="text" class="form-control" id="email" placeholder="邮箱">
</div>
<div class="form-group">
<input type="checkbox" name="allow" id="allow" checked="checked">
<label>同意“别克汇用户使用协议”</label>
<span class="error_tip2">提示信息</span>
</div>
<button type="submit" class="btn btn-default center-block">注册</button>
</form>
</div>
</div>
jsonp
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jsonp</title>
<style type="text/css">
</style>
<!-- <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script> -->
<script type="text/javascript">
// alert($);//function(a,b){return new n.fn.init(a,b)}
/*
jsonp可以跨域请求数据的原理:
主要是利用了script标签可以跨域链接资源的特性
*/
function aa(dat){
alert(dat.name);
}
</script>
<script type="text/javascript" src="js/data.js"></script>
</head>
<body>
</body>
</html>
本地存储
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>本地存储</title>
<style type="text/css">
</style>
<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
//写入
//[{"id":1,"num":2,....},{}..]
localStorage.setItem('mystorage','ok!');
//读取
alert(localStorage.mystorage);//ok!
//写入
// sessionStorage.setItem('name','tom');
//读取
alert(sessionStorage.name);//tom//没有弹undefined
localStorage.setItem('mystorage','{"goods":["1","2"]}');
</script>
</head>
jQueryUI
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jQueryUI</title>
<style type="text/css">
.con{
width: 300px;
height: 300px;
border: 1px solid #000;
margin: 50px auto 0;
}
.box{
width: 50px;
height: 50px;
background-color: gold;
cursor: pointer;/鼠标经过时指针为手的形状/
}
</style>
<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script type="text/javascript">
('.box').draggable({
//约束元素在父级内拖动
containment:'parent',
//限制在X轴方向上可以拖动
axis:'x',
//拖动时透明度变为60%
opacity:0.6,
//可以返回拖动的参数
drag:function(ev,ui){
// console.log(ui);//json格式的对象,offset是绝对位置,position是相对父级的位置
console.log(ui.position.left);//从左到右是1到250
}
});
})
</script>
</head>
<body>
<div class="con">
<div class="box"></div>
</div>
</body>
</html>
网友评论