欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jquery實(shí)現(xiàn)搜索框常見(jiàn)效果的方法

 更新時(shí)間:2015年01月22日 10:52:38   投稿:shichen2014  
這篇文章主要介紹了jquery實(shí)現(xiàn)搜索框常見(jiàn)效果的方法,可實(shí)現(xiàn)搜索框文字顯示效果,非常具有實(shí)用價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了jquery實(shí)現(xiàn)搜索框常見(jiàn)效果的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

復(fù)制代碼 代碼如下:

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>jquery搜索框效果</title>
<script type="text/javascript" src="jquery-1.8.2.min.js"></script>
<script type="text/javascript">
 $(function(){
  var searchBox = $("#search");
  searchBox.focus(function(){
   if(searchBox.val() == this.title){
    searchBox.val("").css({'font-style':'normal','color':'#000'});
   }
  });
  //光標(biāo)離開(kāi)搜索框時(shí)
  searchBox.blur(function(){
   if(searchBox.val() == ""){
    searchBox.val(this.title).css({'font-style':'italic','color':'#ccc'});
   }
  });
  searchBox.blur();
 });
</script>
</head>
<body>
<input id="search" type="text" title="search" value="" /><input type="submit" value="搜索" />
</body>
</html>

希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論