Re-usable JS effect

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.