Js achieves synchronous switching of image and link text effects, js Effects
This example describes how to implement the special effects of synchronous switching between images and link text in JavaScript. Share it with you for your reference. The specific implementation method is as follows:
Copy codeThe Code is as follows: <Title> js image and link text synchronization switchover effect </title>
<Head>
<Script language = JavaScript>
Var imgUrl = new Array ();
Var imgLink = new Array ();
Var imgTz = new Array ();
Var adNum = 0;
ImgUrl [1] = "/images/m01.jpg ";
ImgLink [1] = "http://www.bkjia.com ";
ImgTz [1] = "<a href = #> <font color = white> text link: Text, text, and text </font> </a> ";
ImgUrl [2] = "/images/m02.jpg ";
ImgLink [2] = "http://www.bkjia.com ";
ImgTz [2] = "<a href = #> <font color = white> text link content two wild flowers bloom </font> </a> ";
ImgUrl [3] = "/images/m03.jpg ";
ImgLink [3] = "http://www.bkjia.com ";
ImgTz [3] = "<a href = #> <font color = white> text link content 3 past events such as tea </font> </a> ";
Var j = 0;
For (I = 1; I <= 3; I ++ ){
If (imgUrl [I]! = "") & (ImgLink [I]! = "")){
J ++;
} Else {
Break;
}
}
Function playTran (){
If (document. all)
ImgInit. filters. revealTrans. play ();
}
Var key = 0;
Function nextAd (){
If (adNum <j) adNum ++;
Else adNum = 1;
If (key = 0 ){
Key = 1;
} Else if (document. all ){
ImgInit. filters. revealTrans. Transition = 6;
ImgInit. filters. revealTrans. apply ();
PlayTran ();
}
Document. images. imgInit. src = imgUrl [adNum];
Document. getElementById ('jdtz'). innerHTML = imgTz [adNum];
TheTimer = setTimeout ("nextAd ()", 3000 );
}
Function goUrl (){
JumpUrl = imgLink [adNum];
JumpTarget = '_ blank ';
If (jumpUrl! = ''){
If (jumpTarget! = '')
Window. open (jumpUrl, jumpTarget );
Else
Location. href = jumpUrl;
}
}
</Script>
</Head>
<Body>
<Table> <tr> <td> <a href = "javascript: goUrl ()"> </a> </td> </tr> <td id = jdtz bgcolor =" blue "> </td> </tr> </table>
</Body>
</Html>
I hope this article will help you design javascript programs.