xy95

实现效果:

实现代码:

<html>
<head>
<meta charset="utf8">
</head>
<body>
<table border="1" align="center" width="450" height="101" cellpadding="1" cellspacing="1" bgcolor="#ccff00">
<tr><td height="25" align="center" colspan="2">判断指定的年份是否为闰年</td></tr>
<tr bgcolor="#ffff99">
<td width="200" height="30" >请输入一个四位数的年份:</td>
<td >
<form action="" method="post">
<input type="text" name="year">
<input type="submit" name="submit" value="计算">
</td>
</tr>
<tr>
<td colspan="2" align="center">
<?php
if(isset($_POST[\'submit\'])){
if($_POST[\'year\']=="") echo "请输入年份后再提交!";
else{
$year=$_POST[\'year\'];
$result=($year%4==0&&$year%100!=0)||($year%400==0)?$year."是闰年":$year."不是闰年";
echo $result;
}
}
?>
</td>
</tr>
</table>
</body>
</html>

分类:

技术点:

相关文章:

  • 2021-11-19
  • 2021-11-28
  • 2021-04-09
  • 2021-12-04
  • 2021-11-28
  • 2022-02-01
  • 2021-11-28
猜你喜欢
  • 2021-11-28
  • 2021-11-28
  • 2021-11-28
  • 2021-03-30
  • 2022-12-23
  • 2021-11-28
  • 2021-11-28
相关资源
相似解决方案