Java script What is JavaScript?
The code that is hidden in the HTML part of this page, lets your browser
flash the hyperlinks in four different colors. <script language ="JavaScript"><!-- function initArray() {for (var i = 0; i < initArray.arguments.length; i++) {this[i] = initArray.arguments[i];} this.length = initArray.arguments.length;} // you may fill this colors array with your colors. // the script will rotate the links through these colors var colors = new initArray( "green", "blue", "purple", "red"); pause_time = .5; // in seconds link = 0; // starting color index (in colors array) for unvisited links vlink = 4; // starting color index (in colors array) for visited links function linkDance() { link = (link+1)%colors.length; vlink = (vlink+1)%colors.length; //alert("link "+link+"\r\nvlink "+vlink+"\r\nvlinkColor "+document.vlinkColor); document.linkColor = colors[link]; document.vlinkColor = colors[vlink]; setTimeout("linkDance();",pause_time*1000);} linkDance(); // --> </script> The result will be flashing hyperlinks: for example great java script site 1 great java script site 2 Attention!Java scripts can have several parts in their code. Some parts need to
be put in the header of the html code. JavaScript starts automatically However, the effect can take place immediately, or after you type something or click on a button. Give it a try! |