Ⅰ html下拉框怎麼設置默認值
html下拉框設置默認值,用到的工具:notepad++,步驟如下:
html代碼部分:
<select>
<optionvalue="1">北京</option>
<optionvalue="1"selected>天津</option>
<optionvalue="1">上海</option>
</select>
說明:selected屬性就是默認值,天津被默認選中。
效果圖:
注意事項:默認值只能設置一個,設置多個的話最後一個默認值是最終的默認值。
Ⅱ 高手請進!js如何控制select標簽 默認被選中
<html>
<head>
</head>
<selectid="ss">
<option>aa</option>
<option>aa1</option>
<option>aa2</option>
</select>
<body>
<script>
varss=document.getElementById('ss');
ss[2].selected=true;//選中
</script>
</html>
已測試