HTML DOM Input Week form 属性
htmlweb developmentfront end technology更新于 2025/9/4 13:32:17
HTML DOM Input Week form 属性返回输入周的封闭表单的引用。
语法
以下是语法 −
返回对 form 对象的引用
inputWeekObject.form
示例
让我们看一个 Input Week form 属性的示例 −
<!DOCTYPE html>
<html>
<head>
<title>Input Week form</title>
<style>
form {
width:70%;
margin: 0 auto;
text-align: center;
}
* {
padding: 2px;
margin:5px;
}
input[type="button"] {
border-radius: 10px;
}
</style>
</head>
<body>
<form id="Mid-Term">
<fieldset>
<legend>Week-form</legend>
<label for="WeekSelect">Examination Week:
<input type="week" id="WeekSelect" value="2019-W36">
</label>
<input type="button" onclick="showExamination()" value="What exams are in this week? ">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var inputWeek = document.getElementById("WeekSelect");
function showExamination() {
divDisplay.textContent = 'Examinations: '+inputWeek.form.id;
}
</script>
</body>
</html>
输出
这将产生以下输出 −
点击"本周有哪些考试?"按钮前 −

查看"本周有哪些考试?"按钮后 −

相关文章
有用资源
html 参考教程 - 该教程包含有关 html 的更多信息:https://www.cainiaomax.com/html/

