Ⅰ 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>
已测试