<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> drop-down box </title>
<style>
* {
margin:0;
padding:0;
}
Body {
padding:50px 50px;
}
. btn-select {
position:relative;
Display:inline-block;
width:150px;
height:25px;
Background-color: #f80;
font:14px/20px "Microsoft Yahei";
Color: #fff;
}
. btn-select. Cur-select {
Position:absolute;
Display:block;
width:150px;
height:25px;
line-height:25px;
Background: #f80 URL (ico-arrow.png) no-repeat 125px Center;
text-indent:10px;
}
. btn-select:hover. Cur-select {
Background-color: #f90;
}
. btn-select Select {
Position:absolute;
top:0;
left:0;
width:150px;
height:25px;
opacity:0;
Filter:alpha (opacity:0;);
font:14px/20px "Microsoft Yahei";
Color: #f80;
}
. btn-select Select option {
text-indent:10px;
}
. btn-select Select Option:hover {
Background-color: #f80;
Color: #fff;
}
</style>
<body>
<form>
<a class= "Btn-select" id= "Btn_select" >
<span class= "Cur-select" > Please select </span>
<select>
<option> Option One </option>
<option> Options Two </option>
<option> option three </option>
<option> Options Four </option>
<option> Options Five </option>
</select>
</a>
</form>
<script>
var $$ = function (ID) {
return document.getElementById (ID);
}
Window.onload = function () {
var btnselect = $$ ("Btn_select");
var curselect = Btnselect.getelementsbytagname ("span") [0];
var oselect = btnselect.getelementsbytagname ("select") [0];
var aoption = btnselect.getelementsbytagname ("option");
Oselect.onchange = function () {
var Text=oselect.options[oselect.selectedindex].text;
curselect.innerhtml = text;
}
}
</script>
</body>
CSS Simulation implementation Selec drop-down box