最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

jQuery表單獲取和失去焦點輸入框提示效果的實例代碼

 更新時間:2013年08月01日 16:23:37   作者:  
這篇文章介紹了jQuery表單獲取和失去焦點輸入框提示效果的實例代碼,有需要的朋友可以參考一下
復制代碼 代碼如下:

  $("#focus .input_txt").each(function(){
  var thisVal=$(this).val();
  //判斷文本框的值是否為空,有值的情況就隱藏提示語,沒有值就顯示
  if(thisVal!=""){
  $(this).siblings("span").hide();
  }else{
  $(this).siblings("span").show();
  }
  //聚焦型輸入框驗證 
  $(this).focus(function(){
  $(this).siblings("span").hide();
  }).blur(function(){
  var val=$(this).val();
  if(val!=""){
  $(this).siblings("span").hide();
  }else{
  $(this).siblings("span").show();
  } 
  });
  })
  $("#keydown .input_txt").each(function(){
  var thisVal=$(this).val();
  //判斷文本框的值是否為空,有值的情況就隱藏提示語,沒有值就顯示
  if(thisVal!=""){
  $(this).siblings("span").hide();
  }else{
  $(this).siblings("span").show();
  }
  $(this).keyup(function(){
  var val=$(this).val();
  $(this).siblings("span").hide();
  }).blur(function(){
  var val=$(this).val();
  if(val!=""){
  $(this).siblings("span").hide();
  }else{
  $(this).siblings("span").show();
  }
  })
  }) 
  })
</script>
<style type="text/css">
 form{width:400px;margin:10px auto;border:solid 1px #E0DEDE;background:#FCF9EF;
          padding:30px;box-shadow:0 1px 10px rgba(0,0,0,0.1) inset;}
 label{display:block;height:40px;position:relative;margin:20px 0;}
 span{position:absolute;float:left;line-height:40px;left:10px;color:#BCBCBC;cursor:text;}
 .input_txt{width:398px;border:solid 1px #ccc;box-shadow:0 1px 10px rgba(0,0,0,0.1) inset;
          height:38px;text-indent:10px;}
 .input_txt:focus{box-shadow:0 0 4px rgba(255,153,164,0.8);border:solid 1px #B00000;}
 .border_radius{border-radius:5px;color:#B00000;}
 h2{font-family:"微軟雅黑";text-shadow:1px 1px 3px #fff;}
</style>
</head>
<body>
 <form class="border_radius" id="focus">
        <h2>聚焦型提示語消失  無效果請刷新</h2>
        <label><span>花瓣注冊郵箱</span><input type="text" class="input_txt border_radius"  />
        </label>
        <label><span>密碼</span><input type="text" class="input_txt border_radius" /></label>
    </form>
 <form class="border_radius" id="keydown">
     <h2>輸入型提示語消失</h2>
     <label><span>花瓣注冊郵箱</span><input type="text" class="input_txt border_radius"  />
       </label>
        <label><span>密碼</span><input type="text" class="input_txt border_radius" /></label>
    </form>
</body>
</html>

相關文章

最新評論

墨竹工卡县| 会泽县| 资兴市| 太原市| 垣曲县| 宁强县| 西宁市| 灯塔市| 柞水县| 教育| 福建省| 伽师县| 霍邱县| 永靖县| 射洪县| 莱阳市| 舞钢市| 吴旗县| 定边县| 林芝县| 讷河市| 琼结县| 平阳县| 宾阳县| 吕梁市| 绥江县| 普兰店市| 江陵县| 阿拉善左旗| 宾阳县| 丹东市| 赤城县| 濮阳市| 洛隆县| 平南县| 噶尔县| 银川市| 吉木萨尔县| 棋牌| 张家港市| 吉木乃县|