<body bgcolor= "#000000" >
<div id= "text" style= "font-size:20px;" > Hello, this is a JavaScript code to change the size and color of text </div>
<script type= "Text/javascript" >
var size =;
var falg = 1;
function Colortext ()
{
//Gets the size of the text
document.getElementById ("text"). Style.color = GetColor ();
document.getElementById ("text"). Style.fontsize = GetSize ();
}
Sets the text color
function GetColor ()
{
var mycolor = "#";
var color = "123456789abcdef";
var ColorCode = Color.split ("");
for (Var i=0;i<6;i++)
{
Mycolor+=colorcode[math.floor (15*math.random ())];
}
return mycolor;
}
Returns the font size
function getsize ()
{
if (Falg = 1)
{
size = size+1;
if (size = =
Falg = 0);
return size;
}
if (Falg = = 0)
{
size = size-1;
if (size = =)
Falg = 1;
return size;
}
SetInterval ("Colortext ()");
</script>
</body>