博主分享免费Java教学视频,B站账号:Java刘哥
index.html
first.js
效果图:
本文地址:http://liuyanzhao.com/3449.html
转载请注明
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>判断闰年,平年</title>
- <script src="first.js"> </script>
- </head>
- <body>
- <input type="text" placeholder="请输入年份"id="text">
- <input type="button" id="ok" value="确定">
- <h1 id="result"></h1>
- </body>
- </html>
- window.onload=one;//打开窗口,执行one
- function one()
- {
- document.getElementById("ok").onclick=two; //鼠标点了id=ok后执行two
- function two()
- {
- a=document.getElementById("text").value;
- if(a%4==0&&a%100!=0||a%400==0)
- {
- document.getElementById("result").innerHTML="this is a 闰年";
- }
- else
- {
- document.getElementById("result").innerHTML="this is a 平年";
- }
- }
- }
- 微信
- 交流学习,有偿服务
- 博客/Java交流群
- 资源分享,问题解决,技术交流。群号:590480292
您可以选择一种方式赞助本站
支付宝扫一扫赞助
微信钱包扫描赞助
赏