Java script
Home Up hypertext HTML HTML tags More HTML effects.htm SOUND Colors Java script FTP

Java script   

What is JavaScript?             
It is a set of codes that tells the computer to do something special.
JavaScript is the most popular code for web pages. It is embedded in the html part of your web page
It is very easy to learn the JavaScript Programing language. However, if other people have written something that you like, you can cut and paste a certain feature in your page so it will function on your website too. 

The code that is hidden in the HTML part of this page, lets your browser flash the hyperlinks in four different colors.
It would look something like this. It looks complicated, but you can simple cut and paste it. The effect is written between the <script> and the </script>:

<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.
Some parts need to be put in the body of the html code.
An some parts need to be inserted in the body tag of the html code.
Normally, the tag just says <body> but now it will look like: <body insertjavascriptparthere>

JavaScript starts automatically        However, the effect can take place immediately, or after you type something or click on a button. Give it a try!