写一个html下拉框选个年报、季报和月报,再写一个时间选择器当下拉选择年报时选择器便只选年月(yyyy-MM)类型,当下了选择季报时,时间选择器变成年月为2023-03/2023-06的形式,当选择年报时,则时间选择器变成只需传输年份2023形式,不要用jquery
时间: 2024-02-21 16:00:41
浏览: 20
好的,我来帮你写一个这样的HTML代码。请看下面的代码:
<!DOCTYPE html>
<title>选择报表类型和时间</title>
<[meta](https://geek.csdn.net/educolumn/15164635d3eb50750420f11a3fc347c3?spm=1055.2569.3001.10083) charset="utf-8">
<[meta](https://geek.csdn.net/educolumn/15164635d3eb50750420f11a3fc347c3?spm=1055.2569.3001.10083) name="viewport" content="width=device-width, initial-scale=1">
</head>
<label for="report_type">报表类型:</label>
<select id="report_type" onc[han](https://geek.csdn.net/educolumn/0d22b54eaf6bcf967d9625e1679d00b4?spm=1055.2569.3001.10083)ge="c[han](https://geek.csdn.net/educolumn/0d22b54eaf6bcf967d9625e1679d00b4?spm=1055.2569.3001.10083)geDatepicker()">
<option value="yearly">年报</option>
<option value="quarterly">季报</option>
<option value="monthly">月报</option>
</select>
<label for="datepicker">时间:</label>
<input type="text" id="datepicker" readonly>
<script>
function c[han](https://geek.csdn.net/educolumn/0d22b54eaf6bcf967d9625e1679d00b4?spm=1055.2569.3001.10083)geDatepicker() {
var reportType = document.getElementById("report_type").value;
var datepicker = document.getElementById("datepicker");
if(reportType == "
```