Latest web development tutorials

HTML DOM Pilih beberapa properti

Pilih Object Reference Pilih Objek

Definisi dan Penggunaan

beberapa set properti atau kembali apakah ada lebih dari satu opsi yang dipilih.

tatabahasa

Pengaturan beberapa properti:

selectObject.multiple=true|false

Pengembalian beberapa properti:

selectObject.multiple


Dukungan Browser

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Semua browser utama mendukung beberapa atribut


contoh

contoh

Memilih beberapa pilihan dalam menu drop-down:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
    document.getElementById("mySelect").multiple=true;
}
</script>
</head>
<body>

<form>
<select id="mySelect" size="4">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
</form>
<button type="button" onclick="displayResult()">允许多个选择</button>
<p>按下Ctrl键来选择多个选项</p>

</body>
</html>

Coba »


Pilih Object Reference Pilih Objek