62,269
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form method="post" action="">
<select id="DropDownList">
</select>
</form>
<script type="text/javascript">
<!--
//------------------------------------------------------
// 你可以用document.getElementById()方法
// 然后像楼上那样。也可以简单的加一句如下
// 注:语法-- new Option(Text,Value)
//------------------------------------------------------
document.all.DropDownList.options.add(new Option("请选择...","-1"));
//-->
</script>
</body>
</html>
var oOption = document.createElement("OPTION");
oOption.text = "法拉利";
oOption.value = "4";
document.getElementById("selectid").options.add(oOption);