JavaScript imitation flash focus picture effect support IE and Firefox

Source: Internet
Author: User
Tip: You can modify some of the code before running

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; Charset=utf-8 "/> <style type= text/css" media= "All" > d1{width:443px;height:auto;overflow:hidden;border:# 666666 2px solid;background-color: #000000;p osition:relative;} . Loading{width:443px;border: #666666 2px solid;background-color: #000000; color: #FFCC00; font-size:12px;height:179px ; Text-align:center;padding-top:30px;font-family:verdana, Arial, Helvetica, Sans-serif;font-weight:bold; . D2{width:100%;height:209px;overflow:hidden; num_list{position:absolute;width:100%;left:0px;bottom:-1px; Background-color: #000000; color: #FFFFFF; font-size:12px;padding:4px 0px;height:20px;overflow:hidden; . Num_list span{display:inline-block;height:16px;padding-left:6px;} img{border:0px;} ul{display:none; button{ Position:absolute; z-index:1000; right:0px;bottom:2px; font-size:13px; Font-weight:bold; Font-family:arial, Helvetica, Sans-serif; . B1,.b2{background-color: #666666;d isplay:block;float:left;padding:2px 6px;margin-right:3px;color: #FFFFFF; Text-decoration:none;cursor:pointer;} . B2{color: #FFCC33; Background-color: #FF6633;} </style> <script language= "JavaScript type=" Text/javascript ">/* Power by: *//Main function var s=function () {var interv=2000; Switching interval time var interv2=10; Switch speed var opac1=50; Text background transparency var source= "Fade_focus"//focus rotation picture Container ID Name//Get Object function Gettag (tag,obj) {if (obj==null) {return document.getElementsByTagName (TAG)}else{return obj.getelementsbytagname (TAG)}} function GetID (ID) {return document.getElementById (ID)}; var opac=0,j=0,t=63,num,scton=0,timer,timer2,timer3;var id=getid (source); Id.removechild (Gettag ("div", id) [0]); Li=gettag ("Li", id); var div=document.createelement ("div"); var title=document.createelement ("div"); var span= Document.createelement ("span"); var button=document.createelement ("div"); Button.classnaMe= "button"; for (var i=0;i<li.length;i++) {var a=document.createelement ("a"); a.innerhtml=i+1;a.onclick=function () {cleartimeout (timer); cleartimeout (Timer2); cleartimeout (Timer3); J=parseint (this.innerhtml) -1;scton=0;t=63;o Pac=0;fadeon ();}; A.classname= "B1"; A.onmouseover=function () {this.classname= "B2"};a.onmouseout=function () {this.classname= "B1"; SC ( j)};button.appendchild (a);} Control layer Transparency Function alpha (obj,n) {if (document.all) {obj.style.filter= alpha (opacity= "+n+") ";} Else{obj.style.opacity= (n/100);} Control Focus Button Function SC (n) {for (Var i=0;i<li.length;i++) {button.childnodes[i].classname= "B1"};button.childnodes[n] . classname= "B2";} Title.classname= "Num_list"; Title.appendchild (span); Alpha (TITLE,OPAC1); id.classname= "D1";d iv.classname= "D2"; Id.appendchild (div); Id.appendchild (title); Id.appendchild (button); Fade var fadeon=function () {Opac+=5;div.innerhtml=li[j].innerhtml;span.innerhtml=gettag ("img", Li[j]) [0].alt;alpha (DIV,OPAC); if (scton==0) {SC (j); Num=-2;scrolltxt (); scton=1};if (opac<100) {Timer=settiMeout (FADEON,INTERV2)}else{timer2=settimeout (Fadeout,interv);} Fade var fadeout=function () {opac-=5;div.innerhtml=li[j].innerhtml;alpha (DIV,OPAC); if (scton==0) {num=2;scrolltxt () ; Scton=1};if (opac>0) {timer=settimeout (FADEOUT,INTERV2)}else{if (j<li.length-1) {J++}else{j=0};fadeon ()};} Scrolling text var scrolltxt=function () {t+=num;span.style.margintop=t+ "px"; if (num<0&&t>3) {timer3= SetTimeout (SCROLLTXT,INTERV2)}else if (num>0&&t<62) {timer3=settimeout (SCROLLTXT,INTERV2)}else{ Scton=0}}; Fadeon (); }//initialization of window.onload=s; </script> <title> JavaScript Flash focus picture effect support IE and Firefox </title> </pead> <body> <div id= " Fade_focus "> <div class=" Loading ">loading...<br/></div> <ul> &LT;LI&GT;&LT;/LI&G T <li></li> <li></li> <li></li> </ul> </div> </body> & Lt;/html></td> </tr> </table>
Tip: You can modify some of the code before running

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.