One, the input box focus and Blur
/*Effect of the search box*/$ (function () {$ ("#input-search"). focus (function () {vardefaultvalue=$ ( This). attr ("DefaultValue"); if( This. value==DefaultValue) { This. value=""; }}). blur (function () {if( This. value==""){ This. value=$ ( This). attr ("DefaultValue"); }}). KeyUp (function (e) {if(e.which== -) {alert ("Enter Submit Form"); } }); })
Focus and blur of the input box
Second, Web page skin-changing function (need to combine jquery's cookie plugin, to record the user's choice)
/*The effect of skin change, do not know why, the effect of the cookie does not come out*/function Switchskin (MySkin) {$ ("#skin-css"). attr ("href","styles/skin/"+myskin+". CSS"); $("."+myskin). addclass ("selected"). Siblings (). Removeclass ("selected");$ //for the next time the user opens and refreshes, the last skin is still displayed, and a cookie is used to record the current selection .$.cookie ("Mycssskin", MySkin, {path:"/", Expires:Ten});} $ (function () {varMy_skin=$.cookie ("Mycssskin"); alert (My_skin); if(My_skin) {Switchskin (My_skin); } $(". Skin Li"). Click (function () {My_skin=$( This). attr ("class"); Switchskin (My_skin); });});
jquery for Web page skinning
Re-usable JS effect