【jquery实现下拉列表选择器】jquery实现下拉列表选择

更新时间:2016-02-09    来源:jquery    手机版     字体:

【www.bbyears.com--jquery】



<script src="jquery-1.3.2.js" type="text/javascript"></script>
<script type="text/javascript">
$(function(){
$(".CRselectBox").hover(function(){
  $(this).addClass("CRselectBoxHover");
},function(){
  $(this).removeClass("CRselectBoxHover");
});
$(".CRselectValue").click(function(){
  $(this).blur();
  $(".CRselectBoxOptions").show();
  return false;
});
$(".CRselectBoxItem a").click(function(){
  $(this).blur();
  var value = $(this).attr("rel");
  var txt = $(this).html();
  $("#abc").val(value);
  $("#abc_CRtext").val(txt);
  $(".CRselectValue").html(txt);
  $(".CRselectBoxItem a").removeClass("selected");
  $(this).addClass("selected");
  $(".CRselectBoxOptions").hide();
  return false;
});
/*点击任何地方关闭层*/
$(document).click(function(event){
  if( $(event.target).attr("class") != "CRselectBox" ){
   $(".CRselectBoxOptions").hide();
  }
});
})
</script>


jquery实现下拉框选择图片效果




"  name="abc_CRtext" id="abc_CRtext"/>

猜你感兴趣