{"id":734,"date":"2012-08-12T14:10:43","date_gmt":"2012-08-12T06:10:43","guid":{"rendered":"http:\/\/www.youthtribe.com\/?p=734"},"modified":"2012-08-12T14:10:43","modified_gmt":"2012-08-12T06:10:43","slug":"jquery%e5%ae%9e%e7%8e%b0input%e6%a1%86%e8%87%aa%e5%b7%b1%e9%bb%98%e8%ae%a4%e6%96%87%e5%ad%97%e7%9a%84%e5%8f%98%e5%8c%96-%e5%85%b3%e9%94%ae%e6%98%af%e7%84%a6%e7%82%b9%e7%9a%84%e5%a4%b1%e5%8e%bb","status":"publish","type":"post","link":"http:\/\/www.youthtribe.com\/archives\/734","title":{"rendered":"jquery\u5b9e\u73b0input\u6846\u81ea\u5df1\u9ed8\u8ba4\u6587\u5b57\u7684\u53d8\u5316-\u5173\u952e\u662f\u7126\u70b9\u7684\u5931\u53bb\u4e0e\u83b7\u5f97"},"content":{"rendered":"
\u7f51\u4e0a\u6709\u597d\u591a\u8fd9\u6837\u7684jb\u5e94\u7528\uff1a\u5373\u5f53\u9f20\u6807\u70b9\u5230\u641c\u7d22\u6846\u65f6\uff0c\u9ed8\u8ba4\u7684\u6587\u5b57\u5c31\u4f1a\u6d88\u5931\u4e86\u3002\u9f20\u6807\u79bb\u5f00\u5c31\u4f1a\u53c8\u51fa\u73b0\u9ed8\u8ba4\u7684\u63d0\u793a\u6587\u5b57\u3002\u975e\u5e38\u5b9e\u7528\u3002\u5176\u5b9e\u73b0\u539f\u7406\u4e5f\u662f\u975e\u5e38\u7684\u7b80\u5355\u7684\u3002\u4e0b\u8fb9\u770b\u4ee3\u7801\u5427\uff08\u9700\u8981jquery\u7684\u52a0\u8f7d\u7684\uff09<\/p>\n
\/\/ JavaScript Document
\n\u00a0$(document).ready(function(){
\n\u00a0\/\/focusblur
\n\u00a0jQuery.focusblur = function(focusid) {
\n\u00a0\u00a0var focusblurid = $(focusid);
\n\u00a0\u00a0var defval = focusblurid.val();
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0
\n\u00a0focusblurid.focus(function(){
\n\u00a0\u00a0\u00a0var thisval = $(this).val();
\n\u00a0\u00a0\u00a0\u00a0if(thisval==defval){
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $(this).val(“”);
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 });
\n\u00a0\u00a0\u00a0 focusblurid.blur(function(){
\n\u00a0\u00a0\u00a0var thisval = $(this).val();
\n\u00a0\u00a0\u00a0\u00a0if(thisval==””){
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $(this).val(defval);
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 });
\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0
\n\u00a0\u00a0\u00a0\u00a0 };
\n\u00a0\/*\u4e0b\u9762\u662f\u8c03\u7528\u65b9\u6cd5*\/
\n\u00a0\u00a0\u00a0\u00a0 $.focusblur(“#searchkey”);
\n\u00a0});<\/p><\/blockquote>\n