jsp中如何实现下拉菜单 ??急啊
1个回答
展开全部
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title></title>
</head>
<body>
<select id="selListbox">
</select>
<script language=javascript>
listbox = document.getElementById("selListbox");
function test(listbox,sName,sValue){
op = document.createElement("option");
op.appendChild(document.createTextNode(sName));
if(arguments.length ==3){
op.setAttribute("value",sValue);
}
listbox.appendChild(op);
}
test(listbox,"测试1","4");
test(listbox,"测试2","5");
test(listbox,"测试3");
</script>
</body>
</html>
<head>
<title></title>
</head>
<body>
<select id="selListbox">
</select>
<script language=javascript>
listbox = document.getElementById("selListbox");
function test(listbox,sName,sValue){
op = document.createElement("option");
op.appendChild(document.createTextNode(sName));
if(arguments.length ==3){
op.setAttribute("value",sValue);
}
listbox.appendChild(op);
}
test(listbox,"测试1","4");
test(listbox,"测试2","5");
test(listbox,"测试3");
</script>
</body>
</html>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询