<meta charset="utf-8">
<style>
input{ width:60px;}
#div2{ font-size:30px; color:red;}
</style>
请输入出生年月日<br />
<input type="number" id="year" value="2005" />年<br />
<input type="number" id="month" value="10" />月<br />
<input type="number" id="day" value="1" />日<br />
<button onclick="lookfor()">查询</button>
<div id="div2"></div>
<script>
function lookfor(){
var y = year.value;
var m = month.value;
var d = day.value;
var a = new Date(y+'/'+m+'/'+d);
var b = new Date();
var n = b.getTime() - a.getTime();
n = Math.floor(n/1000/60/60/24);
div2.innerHTML = n+'天';
}
</script>
对象 | 描述 |
---|---|
Array 对象 | |
Boolean 对象 | |
Date 对象 | |
Math 对象 | |
Number 对象 | |
String 对象 | |
RegExp 对象 | |
全局属性和函数 |
对象 | 描述 |
---|---|
Window 对象 | |
Navigator 对象 | |
Screen 对象 | |
History 对象 | |
Location 对象 |
对象 | 描述 |
---|---|
HTML Document | |
HTML Element | |
HTML Attributes | |
HTML Events |
对象 | 描述 |
---|---|
Anchor 对象 | |
Area 对象 | |
Base 对象 | |
Body 对象 | |
Frame/IFrame 对象 | |
Frameset 对象 | |
Link 对象 | |
Meta 对象 | |
Object 对象 |
Image 对象 | |
Option 对象 | |
Select 对象 | |
Style 对象 | |
Table 对象 | |
td / th 对象 | |
tr 对象 | |
Button 对象 | |
Form 对象 | |
Textarea 对象 |
Input Button 对象 | |
Input Checkbox 对象 | |
Input File 对象 | |
Input Hidden 对象 | |
Input Password 对象 | |
Input Radio 对象 | |
Input Reset 对象 | |
Input Submit 对象 | |
Input Text 对象 |
Input Range 对象 | |
Input Number 对象 | |
Input Date 对象 | |
Input Datetime 对象 | |
Input Datetime-local 对象 | |
Input Email 对象 | |
Input Month 对象 | |
Input Search 对象 | |
Input Tel 对象 | |
Input Time 对象 | |
Input Url 对象 | |
Input Week 对象 |