jquery实现上下箭头下拉框
2014-11-24 13:27
405 查看
<html> <head></head> <body> <form class="select"> <input type="text" value="3" id="am" class="am" readonly="" /> <div class="icon"> <div class="up"></div> <div class="down"></div> </div> <div id="HMF-1" style="display: none " class="bm"> <span class="cur">3</span> <span class="cur">2</span> <span class="cur">1</span> </div> </form> </body> </html>
css:
.select { min-width: 34px; position: relative; margin-top:2px; display: inline-block; display: -webkit-inline-box; border: 1px #999999 solid; } .cur { cursor: pointer; display: block; background:#fff; color: #fd7602; height: 22px; line-height: 22px; padding-left:10px; } .cur:hover { background: #878787; color: #fff; } .am { border: 0px; color: #fd7602; cursor: pointer; width: 34px; height: 19px; padding-left: 10px; } .bm { position: absolute; border: 1px #999999 solid; width: 42px; margin-top: -21px; padding-top: 21px; } .icon { position: absolute; top: 0; right: 0; height: 19px; padding: 3px; } .icon div { width: 7px; height: 3px; cursor: pointer; } .icon .up { margin-top:2px; background:url(img/pop/jian.png) top center no-repeat; } .icon .down { margin-top:3px; background:url(img/pop/jian.png) bottom center no-repeat; }
js:
function selectFn(){ var select_index=0; var _span=$('span.cur'); var _am=$('#am'); var _select_div=$('#HMF-1'); $('span.cur').click(function(){ select_index=$(this).index(); _am.val($(this).html()); _select_div.css('display','none'); $('form.select').css('border','1px #999999 solid'); }); _am.click(function(){ if(_select_div.css('display') =='none'){ _select_div.css('display','block'); $('form.select').css('border','none'); } else{ _select_div.css('display','none'); $('form.select').css('border','1px #999999 solid'); } }); $('div.up').click(function(){ select_index = select_index >0 ? (select_index-1) : 0; _am.val(_span.eq(select_index).html()); }); $('div.down').click(function(){ select_index = select_index <_span.length-1 ? (select_index+1) : select_index; _am.val(_span.eq(select_index).html()); }); }
相关文章推荐
- jquery实现标签支持图文排列带上下箭头按钮的选项卡
- jquery实现标签支持图文排列带上下箭头按钮的选项卡
- jQuery实现下拉列表的实现[原]
- VC实现工具栏的下拉箭头按钮
- 如何实现工具栏的下拉箭头按钮
- jquery实现下拉列框(Html.DropDownList)无刷新联动
- ASP.NET MVC + Jquery 实现Ajax下拉框数据三级联动
- 排序上下箭头的是实现
- 用Jquery实现多级下拉框无刷新的联动
- ASP.NET MVC + Jquery 实现Ajax下拉框数据三级联动
- JQuery实现下拉框的选择 与当CheckBox为服务器控件时如何获取值的操作,实现全选与删除
- Dev ExpressDbEditors 中的cxDBComboBox cxDBPopupEdit 用下拉箭头选择录入的实现
- ajax+jquery+flea+smarty实现了通过选择下拉列表动态显示相应的数据
- VC.NET界面编程中关于的ToolBar(工具栏)的编程应用(二)2008/07/01 19:22 上回说到给工具栏上添加IE风格的下拉菜单按钮,我们通过设置工具栏按钮的风格已经完成了下拉菜单按钮的添加,现在我们准备为下拉菜单按钮中响应下拉箭头部分的实现
- fxMarquee - jQuery内容滚动插件实现上下左右滚动
- 如何实现工具栏的下拉箭头按钮
- jQuery实现下拉框省市联动,二级联动
- 用jquery实现简单的年月日下拉框选择
- jquery 操作单选框,复选框,下拉列表实现代码
- dhl:ASP.NET MVC + Jquery实现Ajax下拉框数据2或3级联动(+用户控件)