实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script>
5
function disable()
6
{
7
document.getElementById("mySelect").disabled=true;
8
}
9
function enable()
10
{
11
document.getElementById("mySelect").disabled=false;
12
}
13
</script>
14
</head>
15
<body>
16
17
<form>
18
<select id="mySelect">
19
  <option>Apple</option>
20
  <option>Pear</option>
21
  <option>Banana</option>
22
  <option>Orange</option>
23
</select>
24
<br><br>
25
<input type="button" onclick="disable()" value="Disable list">
26
<input type="button" onclick="enable()" value="Enable list">
27
</form>
28
29
</body>
30
</html>