This is an image special effect that is often used in web design. It achieves rotation between multiple images and is connected separately.CodeIt can only be applied to IE. It has never been well solved under ff. We can see this effect on the Baidu Alliance homepage. FF is supported and it can be added to favorites for backup.
Java code
-
- <SCRIPT>
-
- VaR links =NewArray ();
-
- Links [1] =Http://tongji.baidu.com";
-
- Links [2] =Http://hi.baidu.com/bdadd/blog/item/6f9f80b12e50cf57092302e3.html";
- Links [3] =Http://union.baidu.com/promo/dataunion/index.html";
-
- Links [4] =Http://www.umaz.cn";
-
- VaR IMGs =NewArray ();
-
- For(VAR n =1; N <=5; N ++) IMGs [N] =NewImage ();
- IMGs [1]. Src =Http://union.baidu.com/img/tongji550.gif";
-
- IMGs [2]. Src =Http://union.baidu.com/img/banner071031.jpg";
-
- IMGs [3]. Src =Http://union.baidu.com/img/dataunion0711.jpg";
-
- IMGs [4]. Src =Http://union.baidu.com/img/umaz13_550.jpg";
-
- VaR tits =NewArray ();
- Tits [1] ="Baidu Statistics";
-
- Tits [2] ="Alliance cup photographers Competition";
-
- Tits [3] ="Baidu Industry Report";
-
- Tits [4] ="Alliance logs";
-
-
- VaR imgwidth =550;// Image Width
- VaR imgheight =134;// Image Width
-
-
- VaR STR ="<Style type = 'text/CSS '>";
-
- STR + ="# Imgnv {display: none; position: absolute; bottom:-1px; Right: 0; Height: 16px ;}# imgnv Div {float: Left; margin-right: 1px ;}";
-
- STR + ="# Imgnv Div. On, # imgnv Div. off {margin-bottom: 1px; width: 30px; Height: 15px; line-Height: 18px! Important; line-Height: 15px; font-size: 9px; text-align: center; cursor: pointer; cursor: hand }";
- STR + ="# Imgnv Div. On {Background: # ce0609; color: # FFF; font-weight: bold }";
-
- STR + ="# Imgnv Div. off {Background: #323232; color: # FFF; text-Decoration: None }";
-
- STR + ="# Titnv {margin-top: 3px; color: #000; text-align: center; display: none ;}";
-
- STR + ="</Style>";
-
- STR + ="<Div style = 'position: relative '>";
- STR + ="<Div> <a id = 'dlink' href = '"+ Links [1] +"'Target = '_ blank'> + IMGs [1]. SRC +"'Border = '0' width = '"+ Imgwidth +"'Height = '"+ Imgheight +"'Style = 'filter: alpha (opacity = 100) 'onmouseover = 'pause (true)' onmouseout = 'pause (false) '> </a> </div>";
-
-
- // Modify point 1: add the inner Div content cyclically to Increase the number
- STR + ="<Div id = 'imgnv'> <Div id = 'it1' class = 'on' onmouseover = 'imgswitch (1, true) 'onmouseout = 'pause (false) '> 1 </div> <Div id = 'it2' class = 'off' onmouseover = 'imgswitch (2, true)' onmouseout = 'pause (false) '> 2 </div> <Div id = 'it3' class = 'on' onmouseover = 'imgswitch (3, true)' onmouseout = 'pause (false) '> 3 </div> <Div id = 'it4' class = 'off' onmouseover = 'imgswitch (4, true)' onmouseout = 'pause (false) '> 4 </div>";
-
- STR + ="<Div id = 'titnv'> <B>"+ Tits [1] +"</B> </div>";
- STR + ="</Div>";
-
- Document. Write (STR );
-
-
- VaR OI = Document. getelementbyid ("Dimg");
-
- VaR pause =False;
-
- VaR curid =1;
-
- VaR lastid =1;
-
- VaR Sw =1;
-
- VaR opacity =100;
- VaR speed =15;
-
- VaR delay = (document. All )?400:700;
-
-
- Function setalpha (){
-
- If(Document. All ){
-
- If(OI. filters & Oi. Filters. Alpha) Oi. Filters. Alpha. Opacity = opacity;
-
- }Else{
- Oi. style. Required opacity = (opacity> =100)?99: Opacity )/100;
-
- }
-
- }
-
-
- Function imgswitch (ID, p ){
-
- If(P ){
-
- Pause =True;
-
- Opacity =100;
-
- Setalpha ();
-
- }
- Oi. src = IMGs [ID]. SRC;
-
- Document. getelementbyid ("Dlink"). Href = Links [ID];
-
- Document. getelementbyid ("It"+ Lastid). classname ="Off";
-
- Document. getelementbyid ("It"+ Id). classname ="On";
-
- Document. getelementbyid ("Titnv"). Innerhtml ="<B>"+ Tits [ID] +"</B>";
- Curid = lastid = ID;
-
- }
-
-
- Function scrollimg (){
-
- If(Pause & opacity> =100)Return;
-
- If(SW =0){
-
- Opacity + =2;
- If(Opacity> delay) {opacity =100; Sw =1;}
-
- }
-
- If(SW =1){
-
- Opacity-=3;
-
- If(Opacity <10) {Opacity =10; Sw =3;}
-
- }
-
- Setalpha ();
- If(SW! =3)Return;
-
- Sw =0;
-
- Curid ++;
-
- // Modify point 2: Here, 4 is also the number
-
- If(Curid>4) Curid =1;
-
- Imgswitch (curid,False);
-
- }
-
-
- Function pause (s ){
- Pause = s;
-
- }
-
-
- Function startscroll (){
-
- Setinterval (scrollimg, speed );
-
- }
-
-
- Function checkload (){
-
- If(IMGs [1]. Complete =True& IMGs [2]. Complete =True){
-
- Clearinterval (checkid );
- SetTimeout (startscroll,2000);
-
- }
-
- }
-
-
- VaR checkid = setinterval (checkload,10);
-
- </SCRIPT>