Discussion.
This is taken from Doug Popeney's collection
of JavaScripts, with some minor tweaking and
reformatting. It is a complex script and I have
not tried to understand its internals in complete
detail. I leave that to the cliche "interested
student" -- who also has enough time!
Please note the following:
- The script is placed in the HTML BODY, not the HEAD.
You can place the LED sign almost anywhere you want it
to appear, though I found it did not work when nested in
a TABLE (maybe I made a mistake or maybe this is some
bug or feature lurking in the JavaScript code -- I dunno).
- The width of the display panel is calculated in the
script, based on the length of the longest message line.
- Messages are easily added and deleted in the script,
with no upper limit. They must contain defined characters,
which means no upper case. If you use upper case you
will get a JavaScript error when it comes to display that
letter. If in doubt as to the defined characters, study
the script. Messages are stored in a straight-forward
fashion at the top of the script, with message numering
starting with zero. This example has four messages. To
add a fifth, you would add the line:
messages[4]="yadda, yadda, yadda."
- The delay between messages is currently set
to 3000 milliseconds (3 seconds) in the line:
var pause = 3000
- To support the script you need two GIF files, one
for the background color ("LED-off.gif") and one for
the character symbols ("LED-on.gif"), which are
now set respecitvely to black and green. To change
either color you would need to replace the file with
a graphic of the same size. You could also change
the names of these files as long as you similarly change
the two script lines where they are defined.
- Notice that Popeney did a nice thing in designing
this to give the page viewer control over the start and
stop of the display scrolling. However, if you wanted the
scrolling to start automatically whenever the page loads,
you could delete the line at the end of the script that
contains "onClick="startSign()" and modify the BODY tag:
<BODY BGCOLOR="#FFFFFF" onLoad="startSign()">
|