HTMLDOM入力DatetimeLocalタイププロパティ
HTML DOM入力DatetimeLocalタイププロパティは、入力DatetimeLocalのタイプを返す/設定します。
構文
以下は構文です-
- 文字列値を返す
inputDatetimeLocalObject.type
- タイプの設定 文字列値へ
inputDatetimeLocalObject.type = stringValue
文字列値
ここでは、「stringValue」 次のようになります-
| stringValue | 詳細 th> |
|---|---|
| 日付 | 入力タイプが日付であることを定義します |
| datetime-local | 入力タイプがdatetime-localであることを定義します |
| チェックボックス | 入力タイプがチェックボックスであることを定義します |
| テキスト | 入力タイプがテキストであることを定義します |
例
入力日時ローカルタイプの例を見てみましょう プロパティ-
<!DOCTYPE html>
<html>
<head>
<title>Input DatetimeLocal type</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>
<fieldset>
<legend>Datetime-Local-type</legend>
<label for="datetimeLocalSelect">Inauguration Date-Time :
<input type="datetime-local" id="datetimeLocalSelect" value="2020-01-01T10:00">
</label>
<input type="button" onclick="getEvent()" value="Where is the event? ">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var inputDatetimeLocal = document.getElementById("datetimeLocalSelect");
function getEvent() {
if(inputDatetimeLocal.type === 'datetime-local')
divDisplay.textContent = 'Event Inauguration near you';
else
divDisplay.textContent = 'Event Inauguration in India';
}
</script>
</body>
</html> 出力
これにより、次の出力が生成されます-
「イベントはどこですか?」をクリックする前に ボタン-
「イベントはどこですか?」をクリックした後 ボタン-
-
HTMLDOM入力番号タイププロパティ
HTML DOM入力番号typeプロパティは、type =” number”を持つinput要素に関連付けられています。入力された数値要素の数値を常に返します。 構文 以下は、数値タイププロパティの構文です- numberObject.type 例 HTMLDOM入力番号タイププロパティの例を見てみましょう- <!DOCTYPE html> <html> <body> <h1>Input Number type property</h1> PHONE NO: <input type="number" id
-
HTMLDOM入力リセットタイププロパティ
HTML DOM入力リセットタイププロパティは、type =” reset”を持つ入力要素に関連付けられています。入力リセット要素に対しては常にリセットを返します。 構文 以下は、リセットタイププロパティの構文です- resetObject.type 例 リセットタイププロパティの例を見てみましょう- <!DOCTYPE html> <html> <body> <h1>Input reset type Property</h1> <form style="border:solid 2px green;padding