JS analog filter picture fade effect _javascript Skills

Source: Internet
Author: User
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd" > <ptml> &L t;head> <meta http-equiv= "Content-type" content= "text/html"; charset=gb2312 "> <title> Untitled document </title> <style> #pshow {margin:auto;width:180px;height:137px; Filter:progid:DXImageTransform.Microsoft.Alpha (opacity=100);} </style> <script language= "javascript" type= "Text/javascript" >/*imagechange start*/var changetime=2000, gradechangetime=100,changespeed=10,imagecounter=4,nowimage,startopacity; var imagelink=new Array () var Filterobj,imageobj,changecontrol; function Changeinit () {Filterobj=document.getelementbyid ("pshow"); Imageobj=filterobj.childnodes[0]; if (document.all) startopacity=filterobj.filters[0]. Opacity; for (i=0;i<imagecounter;i++) imagelink[i]= "Http://bbs.blueidea.com/images/blue/smilies/icon" + (i+8) + ". gif"; Nowimage=math.floor (Math.random () *4); Imageobj.src=imagelinK[nowimage]; Changecontrol=setinterval ("changeimg ();", changetime); The function changeimg () {if (document.all) {clearinterval (Changecontrol); Gradedescopt (); } Else{imageobj.src=imagelink[nowimage];} Nowimage==3? nowimage=0:nowimage++; The function gradeaddopt () {if (startopacity<100) {startopacity+=changespeed; Startopacity>100? startopacity=100:{}; Filterobj.filters[0]. opacity=startopacity; SetTimeout ("gradeaddopt ();", gradechangetime); } else{changecontrol=setinterval ("changeimg ();", changetime); The function gradedescopt () {if (startopacity>0) {startopacity-=changespeed; Startopacity<0? startopacity=0:{}; Filterobj.filters[0]. opacity=startopacity; SetTimeout ("gradedescopt ();", gradechangetime); } else {imageobj.src=imagelink[nowimage]; Gradeaddopt (); Return }/*imagechange End-------------------------------------------------------------/* </script> </pead> <body onload= "Changeinit ();" > <div id= "pshow" ></div> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Oh, do the website when wrote a simulation filter picture fade effect, if the original has such a post, please help me to see the following questions, thank you!
Although it can be run, but put on my site on the rotation of the picture when the CPU occupancy rate increased by about 15%, but the individual browsing will not, do not know how the matter, please enlighten.

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.