JQuery dropdown

<!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>
<title>Drop box</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="js/jquery.js"></script>
<style>
div.dropdown{height:23px;background:none;margin:0;width:200px;}
.dropdown{outline:none;}
.dropdown h4{display:block;margin:0;height:23px;font:12px/23px Arial,Helvetica,sans-serif; text-decoration:underline;color: #666;}
.dropdown h4 span{background: url(images/ico_select.gif) no-repeat 100% 50%;padding-right: 20px;cursor:pointer}
.dropdown ul{position:absolute;background:url(images/bg_country_a.gif) no-repeat 0 0; _background-attachment:fixed;width:170px;padding-top:10px;display:none;margin:0;padding:0;height:150px; }
.dropdown ul li{width:145px;margin:0;margin-left:2px;}
.dropdown ul li{background:#FFF;height:19px;display:block;cursor:pointer;font:400 11px/19px Arial,Helvetica,sans-serif;margin:0 0 6px 3px; background:none;}
.dropdown ul li.over{background:#efefef}
.dropdown ul li img {margin-right:4px;}
</style>

</head>
<body>
<div id="div_currency" class="dropdown" hidefocus="true" tabindex="1">
<h4><span>Change Currency</span></h4>
<ul style="display: none; " class="options">
<li class=""> Current Currency</li>
<li class=""><img src="images/GBP.gif">GBP 53.45 ~ 71.94 </li>
<li class=""><img src="images/EUR.gif">EUR 64.79 ~ 87.20 </li>
<li class=""><img src="images/CAD.gif">CAD 85.85 ~ 115.54 </li>
<li class=""><img src="images/AUD.gif">AUD 96.38 ~ 129.71 </li>
</ul>
</div>

<div id="book" class="dropdown" hidefocus="true" tabindex="1">
<h4><span>Change Currency1</span></h4>
<ul style="display: none; " class="options">
<li class=""><img src="images/EUR.gif">EUR 64.79 ~ 87.20 </li>
<li class=""><img src="images/GBP.gif">GBP 53.45 ~ 71.94 </li>
<li class=""><img src="images/CAD.gif">CAD 85.85 ~ 115.54 </li>
<li class=""><img src="images/AUD.gif">AUD 96.38 ~ 129.71 </li>
</ul>
</div>

<script type="text/javascript">
(function($){
$.fn.extend({
dropdown: function() {
return this.each(function(i,obj){
var obj= $(this);
$("h4 span",obj).click(function(){
$(".options",obj).show();
});
obj.bind("blur",function(){
$(".options",obj).hide();
});
$("li",obj).click(function(){
$("h4 span",obj).html($(this).html());
$(".options",obj).hide();
})
});
}
});
})(jQuery);
$(document).ready(function(){
$(".dropdown").dropdown();

});
</script>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值