Select typeプロパティ

Select 对象参考手册Select オブジェクト

定義と使い方

type プロパティは、ドロップダウンリストのフォームタイプを返します。ドロップダウンリストの場合、タイプは常に "select-one" または "select-multiple" です。

構文

selectObject.type


ブラウザサポート

Internet ExplorerFirefoxOperaGoogle ChromeSafari

すべての主要ブラウザが type プロパティをサポートしています。


例

例

次の例では、ドロップダウンリストのフォームタイプを返します:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>初心者チュートリアル(example.com)</title>
<script>
function displayResult(){
  alert(document.getElementById("mySelect").type);
}
</script>
</head>
<body>

<form>
<select id="mySelect">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
</form>
<button type="button" onclick="displayResult()">ドロップダウンリストのタイプを表示</button>

</body>
</html>

試してみる »


Select 对象参考手册Select オブジェクト その他の拡張