HTML DOM 输入周表单属性
HTML DOM 输入周表单属性返回输入周的封闭表单的引用。
语法
以下是语法 −
返回指向表单对象的引用
inputWeekObject.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>输出
它将产生以下输出 −
在点击‘本周有什么考试?’按钮之前 −

在勾选‘本周有什么考试?’按钮之后 −

广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP