ITeye博客

select中selected

chengxianju · 2010-09-08 10:43 · DIV+CSS · Web前端 · HTML · JavaScript · Apple · Markdown

<html>
<head>
<script type="text/javascript">
function selectOrange()
  {
  document.getElementById("orange").selected=true;
  }
</script>
</head>

<body>
<form>
请选择您喜欢的水果:
<select>
  <option id="apple">苹果</option>
  <option id="orange">桔子</option>
  <option id="pineapple" selected="selected">菠萝</option>
  <option id="banana">香蕉</option>
</select>
<br /><br />
<input type="button" onclick="selectOrange()" value="选择桔子">
</form>
</body>
</html>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。