HTMLDOM入力URL無効プロパティ
HTML DOM入力URL無効プロパティは、入力URLが有効か無効かを設定/返します。
構文
以下は構文です-
- ブール値を返す-true/false
inputURLObject.disabled
- booleanValueへの無効化の設定
inputURLObject.disabled = booleanValue
ブール値
ここでは、「booleanValue」 次のようになります-
| booleanValue | 詳細 th> |
|---|---|
| True | 入力URLが無効になっていることを定義します。 |
| False | 入力URLが無効にならず、デフォルト値でもあることを定義します。 |
例
入力URLが無効になっているの例を見てみましょう プロパティ-
<!DOCTYPE html>
<html>
<head>
<title>Input Email disabled</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>Email-disabled</legend>
<label for="EmailSelect">Employee Email :
<input type="email" id="EmailSelect" value="xyz@abc.com">
</label>
<input type="button" onclick="getdisabled()" value="Confirm Email">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var inputEmail = document.getElementById("EmailSelect");
function getdisabled() {
inputEmail.disabled = true;
divDisplay.textContent = 'Email: '+inputEmail.value+' submitted.';
}
</script>
</body>
</html> 出力
これにより、次の出力が生成されます-
[回答の確認]をクリックする前に ボタン-
[回答の確認]をクリックした後 ボタン-
-
HTMLDOM入力URL名プロパティ
HTML DOM入力URLnameプロパティは、入力URLのnameプロパティの値である文字列を返します。ユーザーはそれを新しい文字列に設定することもできます。 構文 以下は構文です- 文字列値を返す inputURLObject.name 名前の設定 文字列値の属性 inputURLObject.name = ‘String’ 例 入力URL名の例を見てみましょう プロパティ- <!DOCTYPE html> <html> <head> <title>Input URL name</title>
-
HTMLDOM入力URLmaxLengthプロパティ
HTMLDOM入力URLmaxLengthプロパティは、入力URLのmaxLengthプロパティを返す/設定します。定義されていない場合、このプロパティは「-1」を返します。 構文 以下は構文です- maxLength属性を返す inputURLObject.maxLength maxLengthプロパティを数値に設定します inputURLObject.maxLength = number 例 入力URLmaxLengthプロパティの例を見てみましょう- <!DOCTYPE html> <html> <head> <title>In