HTMLDOM入力URLフォームプロパティ
HTML DOM入力URLフォームプロパティは、入力URLの囲みフォームの参照を返します。
構文
以下は構文です-
フォームオブジェクトへの参照を返す
inputURLObject.form
例
入力URLフォームの例を見てみましょう プロパティ-
<!DOCTYPE html>
<html>
<head>
<title>Input URL 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="Larry Page">
<fieldset>
<legend>URL-form</legend>
<label for="URLSelect">URL :
<input type="URL" id="URLSelect" size="25">
</label>
<input type="button" onclick="getform()" value="Get Co-founder">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
var divDisplay = document.getElementById("divDisplay");
var inputURL = document.getElementById("URLSelect");
function getform() {
if(inputURL.value !== '')
divDisplay.textContent = 'Co-founder: '+inputURL.form.id;
else
divDisplay.textContent = 'Please enter valid URL';
}
</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