文本框提示输入

 1     var fbp = false;
 2     $("#groupsjname").live("focus",function() {
 3         $(this).css("border", "1px solid #4489d1"); 
 4         fbp = true;
 5         if ($(this).val() == "" || $(this).val() == "输入商家名称") {$(this).val(""); }
 6     }).blur(function(){
 7         if ($(this).val() == "" || $(this).val() == "输入商家名称") {$(this).val('输入商家名称');}
 8         fbp = false; 
 9         if ($(this).val().replace(/\s+/g, "").length > 0) { 
10             $(this).css("border", "1px solid #4489d1"); 
11         }
12         else {
13             $(this).css("border", "1px solid #cecece"); 
14         }
15     }).hover(function() { 
16             $(this).css("border", "1px solid #4489d1");
17         }, function() { 
18             if (fbp) { 
19                 $(this).css("border", "1px solid #4489d1"); 
20             } 
21             else {
22                 $(this).css("border", "1px solid #cecece"); 
23             } 
24        });
posted @ 2012-04-12 17:53  txsun  阅读(254)  评论(0编辑  收藏  举报