div+js模拟有滚动条的select下拉菜单,求代码(像图片相同的样式)分数可追加
展开全部
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body onload= "SetPos() ">
<script>
function SetPos()
{
s = document.getElementById( "test ")
for(i = 0;i <s.length;i++)
{
if(s[i].text == "6 ") s[i].selected=true
}
}
</script>
<select name= "test " size= "3 " multiple= "MULTIPLE " id= "test ">
<option value= "a "> 1 </option>
<option value= "b "> 2 </option>
<option value= "c "> 3 </option>
<option value= "d "> 4 </option>
<option value= "e "> 5 </option>
<option value= "f "> 6 </option>
<option value= "g "> 7 </option>
<option value= "h "> 8 </option>
</select>
</html>
仅供参考,自己美化,呵呵
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body onload= "SetPos() ">
<script>
function SetPos()
{
s = document.getElementById( "test ")
for(i = 0;i <s.length;i++)
{
if(s[i].text == "6 ") s[i].selected=true
}
}
</script>
<select name= "test " size= "3 " multiple= "MULTIPLE " id= "test ">
<option value= "a "> 1 </option>
<option value= "b "> 2 </option>
<option value= "c "> 3 </option>
<option value= "d "> 4 </option>
<option value= "e "> 5 </option>
<option value= "f "> 6 </option>
<option value= "g "> 7 </option>
<option value= "h "> 8 </option>
</select>
</html>
仅供参考,自己美化,呵呵
追问
我测试了下,不是要求的那样;我现在正在用div模拟select下拉菜单
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询