<Script type = "text/javascript"> // JavaScript Document // Define global variables Var title = new Array (); Title [0] = "1. The first wave of shopaholics during the sales promotion is three crazy days! "; Title [1] = "2. 10-year sales promotion session: 39/99/169! "; Title [2] = "3. off for the entire audience and enjoy great value and low price! "; Title [3] = "4. Store celebration offers a off cap for a large number of books "; Var NowFrame = 1; // display the first image first Var MaxFrame = 4; // a total of five images Function show (d1 ){ If (Number (d1 )){ ClearTimeout (theTimer); // clears the timer when a button is triggered. NowFrame = d1; // set the currently displayed Image } For (var I = 1; I <(MaxFrame + 1); I ++ ){ If (I = NowFrame ){ Document. getElementById ("Rotator"). src = "ad-0" + I + ". jpg"; // display the current image Document. getElementById ("fig _" + I). innerHTML = title [I-1]; // display the title of the current image Document. getElementById ("fig _" + I). className = "numberOver"; // set the CSS style of the current title } Else { Document. getElementById ("fig _" + I). innerHTML = I; Document. getElementById ("fig _" + I). className = "number "; } } If (NowFrame = MaxFrame) {// sets the next image to be displayed. NowFrame = 1; } Else { NowFrame ++; } } Var theTimer = setInterval ('show () ', 3000); // sets the timer to display the next image. Window. onload = show; // run the show () function when loading the page () </Script> |