div+js模拟有滚动条的select下拉菜单,求代码(像图片相同的样式)分数可...
发布网友
发布时间:2022-04-26 19:01
我来回答
共1个回答
热心网友
时间:2022-04-20 15:04
<!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>
仅供参考,自己美化,呵呵追问我测试了下,不是要求的那样;我现在正在用div模拟select下拉菜单