JS Implementation div Flicker-------Day46

Source: Internet
Author: User

Recently learning to use Easyui, found that the framework used to be convenient and concise, can make this framework is the big God level it, cattle ah ....

Today encountered this application can be said to let me very silent, the whole source to see the understanding, but before it is still feeling very magical, I often tell myself, to use more brains, actually some have thought, but it is very far-fetched, and when the source to see the time but also exceptionally understand, If this time I can see their expression, is probably a tangled bar, if the quantitative change caused by qualitative change, then my quantity is too poor, even the well-informed are not, what to talk about creating AH.

First to analyze the principle of implementation, the principle of flashing is what: in fact, thedisplay in the None and block between the frequent alternating , so you understand it.

Or the code first:

HTML section:

<div style= "Width:50px;height:50px;background-color:cyan;display:block;" id= "Showzone" ></div>// Is it familiar?
JavaScript section:

Window.onload=function () {var Obj=document.getelementbyid ("Showzone"); var timer=null;obj.onclick=function () {var i= 0;clearinterval (timer); Timer=setinterval (function () {obj.style.display=i++%2? " None ":" Block ";//There is a harvest, this is more than if. Else must be a lot simpler i>8&&clearinterval (timer),//The short-circuit with the classic Ah},80);};
Although the principle is simple, but the predecessor of the code than I personally write code to be too much simpler, or very rewarding.


Easyui also entered the study schedule, the day by day is more and more full ah ... Come on, stupid bird fly fly ...




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.