动态日历
在文本框中输入相应的年和月就可以生成当月的日历。
(背景色可以设置,当然我使用了猛男最喜欢的pink)
实现原理
在html中写入输入框和日历主键,用css修饰,在css中输入相应的年和月,在js中获取年和月,进行处理,生成日历,返回html中
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>calendar</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
outline: none;
box-sizing: border-box;
}
ul,ol,li{
list-style: none;
}
a,img,span{
display: inline-block;
}
.input-text{
position: absolute;
top: 19%;
left: 50%;
width: 420px;
height: 50px;
margin: 0 0 0 -150px ;
}
.input-text > input{
border: 1px solid gainsboro;
margin: 0 20px 0 0;
height: 50px;
width: 160px