<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
Remove this if you use the .htaccess -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>test</title>
<meta name="description" content="" />
<meta name="generator" content="Studio 3 http://aptana.com/" />
<meta name="author" content="lixuejian" />
<meta name="viewport" content="width=device-width; initial-scale=1.0" />
<!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="stylesheet" href="css/style-ys.css" />
<style type="text/css">
body,div,h1,h2,h3,h4,h5,h6,ol,ul,li,dl,dd,p,table{ margin:0; padding: 0; font-weight: normal;}
ul,li{ list-style-type: none;}
body{ font-size:12px; line-height:20px;}
/* select options */
#sel_list{position: relative; margin-left: 30px; margin-top:100px;}
#sel_show{ width:95px; height:21px; background: url(images/img-common.gif) no-repeat -225px 0; text-indent:5px; cursor: default;}
#sel_ul{ display: none; position:absolute; top:21px; border:#7aa8c8 solid 1px; border-top:0 none; width: 92px; line-height: 20px; background-color: #ffffff; z-index: 99;}
#sel_ul li{ text-indent:5px; border-bottom:#bbd7f9 solid 1px; cursor: default; }
#sel_ul li.active{ background-color: #b0d1f9;}
</style>
</head>
<body>
<div class="t_r" id="sel_list">
<div id="sel_show">语言选择</div>
<ul id="sel_ul">
<li id="li_0">语言选择</li>
<li id="li_1">简体中文</li>
<li id="li_2">英文</li>
</ul>
<select id="sel" name="language" style="display:none;">
<option selected="selected">语言选择</option><option>简体中文</option><option>英文</option>
</select>
</div>
<script type="text/javascript">
var obj =document.getElementById("sel_show");
var ul = document.getElementById("sel_ul");
var sel =document.getElementById("sel").getElementsByTagName("option");
var list,n;
obj.onclick=function(){
ul.style.display = "block";
}
function setSelected(){
list = ul.getElementsByTagName("li");
for(var k=0; k<list.length; k++){
list[k].onclick=function(){
obj.innerHTML=this.innerHTML;
ul.style.display = "none";
n = this.id.split('_').pop(); //当前li的索引值
sel[n].selected="selected";
}
list[k].onmouseover=function(){
this.className="active";
}
list[k].onmouseout=function(){
this.className="";
}
}
}
setSelected();
</script>
</body>
</html>
自定义-js模仿下拉框效果
5星 · 超过95%的资源 需积分: 9 97 浏览量
2011-07-21
12:20:01
上传
评论
收藏 41KB RAR 举报
kalabing
- 粉丝: 10
- 资源: 6
最新资源
- 信呼OA系统2.1.7版源码
- 3122080306 邹子轩 实验报告二.docx
- 基于STM32 NUCLEO板设计彩色LED照明灯(纯cubeMX开发)(大赛作品,文档完整,可直接运行)
- 发那科工业机器人保养大全
- Sphere.h
- REMD固有时间尺度分解信号分量可视化(Matlab完整源码和数据)
- 嵌入式系统双单片机STC89C52+STC15W104多功能学习板电路图可扩展 适用于单片机初学者和教学
- 基于STM32蓝牙控制小车系统设计(硬件+源代码+论文)大赛作品
- XILINXFPGA源码基于Spartan3火龙刀系列FPGA开发板VGA测试例程
- Java聊天室的设计与实现【尚学堂·百战程序员】
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈