Advertisement
7_2009-2012 Graphics #219692

Cool Glowing Text Using only Javascript!

This code is a simple demonstration of a text that fades in and fades out using only Javascript. You can customize this code to display your own custom messages. Cool!

AI

Riepilogo AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Codice sorgente
original-source
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Glowing Text Javascript &copy; Mike McGrath UK 1999</TITLE>
<SCRIPT LANGUAGE="javascript" TYPE="text/javascript">
<!-- Original: Mike McGrath (mike_mcgrath@lineone.net) -->
<!-- Web Site: http://website.lineone.net/~mike_mcgrath -->
<!--
var loop = true;  // toggle on/off
var xpos = "20";  // left distance
var ypos = "30";  // top distance
var wide = "325";  // layer width
var rate = "250";  // change speed
var tnum = "1";
var t = new Array(); 
t[1] = ".....Welcome to this .....";
t[2] = "...Simple Demonstration...";
t[3] = ".... It\'s Just Javascript !";
var cnum = "1";
var c = new Array();
c[1] = "black";
c[2] = "gray";
c[3] = "silver";
c[4] = "whitesmoke";
c[5] = "white";
c[6] = "white";
c[7] = "white";
c[8] = "whitesmoke";
c[9] = "silver";
c[10] = "gray";
c[11] = "black";
c[12] = "black";

if(document.layers)document.write("<layer name='hi' Left='"+xpos+"' Top='"+ypos+"' Width='"+wide+"'></layer>");
if(document.all)document.write("<div id='hi' style='position:absolute;left:"+xpos+";top:"+ypos+";width:"+wide+"'></div>");
function glow()
{
	if(document.layers)
	{
		if(tnum < t.length)
		{
			if(cnum < c.length-1)
			{
				document.layers["hi"].document.write("<font size=5 color='"+c[cnum]+"'>"+t[tnum]+"</font>");
				document.layers["hi"].document.close();
				cnum++;
			}
			else
			{	
    cnum = 1;
			 tnum++;
    if(loop)
    {
     if(tnum == t.length) tnum = 1;
    }
			}
 		setTimeout("glow()",rate);
		}
  else
  {
   document.layers["hi"].document.write("");
	  document.layers["hi"].document.close();
  }
	}
 if(document.all)
	{
	 if(tnum < t.length)
		{
			if(cnum < c.length-1)
			{
				document.all("hi").innerHTML = "<font size=5 color='"+c[cnum]+"'>"+t[tnum]+"</font>";
				cnum ++;
			}	
			else
			{
			 cnum = 1;
    tnum ++;
    if(loop)
    {
     if(tnum == t.length) tnum = 1;
    }
			}
	  setTimeout("glow()",rate);
		}
  else document.all("hi").innerHTML = "";
	}
}
onload=glow;
//-->
</SCRIPT>
</HEAD>
<BODY BGCOLOR="black">
</BODY>
</HTML>
Commenti originali (3)
Recuperato da Wayback Machine