So, You Want A JavaScript Ticker Tape, Huh?

By Joe Burns

http://www.htmlgoodies.com/beyond/javascript/article.php/3472361/So-You-Want-A-JavaScript-Ticker-Tape-Huh.htm (Back to article)

Use these to jump around or read it all...

[The Script] [Placing It On Your Page]
[Activating The Script] [Go Faster!]

     Isn't that thing neat? I love it! Hopefully you can find a way to use it on your page. It's not tough, but you may want to first complete my original JavaScript tutorial. It's easier. Click Here to go, then come on back. If you're staying... a few things first :


The Script

     In order to do this, you need the script! This script is basically a little program that sits on your page and performs tricks when you ask it to. It is different from an applet in that it accompanies the HTML page, whereas the applet is its own small object-oriented program.

     I'm getting ahead of myself... the script! Yes, the script. I have it here for you in basic text. When it comes up on your browser, grab it one of two ways: (1) Copy and paste it or (2) download it by choosing FILE and SAVE AS. Just remember to save it as TEXT!

Click Here To Get It---->HERE. (Get it? Click here! I kill me.)

     Now that you have it, don't mess with it. You see, not only is the script in a certain language, but it is also in a certain format. If you click around with it making things closer together or changing the look... well... basically you mess it up. So, as your mother once told you, leave it alone or it'll just get worse.


Placing It On Your Page

     As was suggested in the other JavaScript tutorial, it would be best if you had three windows going right now:

Here we go....

     Okay, here's where it gets a little tricky. If you've already read my other JavaScript tutorial, you know you have to modify the script in order to tell it what to say. But not here! Yes, I know the script has something that says tt_message ".". Don't change it.

     Notice that the script is set off by a couple of strange commands that look like this:

<!--      and     -->

     Those two little deals alert the browser that what is between them is not to be used. Using these commands, you can leave a message for yourself in your HTML document without it appearing on the screen. Sort of like this:

<!--Pick up milk and eggs after writing this tutorial-->

     This script is not immediately activated. It has to be called for in your document. Think of it as if you sent two items, a script and an HTML document. Somewhere in the document you will give a trip signal and the JavaScript will be called for. This gives you the ability to place the script anywhere you want on your page. So, let's do it already!


Activating The Script

     Here's what is required to activate the script:

<script language="javascript">
ticker ("THE SCRIPT GOES HERE");
</script>

     You can take it right from here by copying the text, or retype it on your own page. It's not that long.

     See where it says "THE SCRIPT GOES HERE"? Uuuuuh, that's where your script goes. Clever, huh? Just make sure to leave all the other good stuff. Only replace "THE SCRIPT GOES HERE". You need the ( ) marks and the semicolon following. There may be a limit to the number of characters you can have on the ticker line, but I haven't found it yet. Bill Welliver keeps a local newspaper home page and he puts in full paragraphs, so I wouldn't be too concerned.


Go Faster You Script You!

     I'll tell you a few changes Bill said can be made, but remember I said right here that you're at your own risk when you start messing with the program itself. Here are a few things you can play with:

Can I Get A Second Script On The Same Page?

     No. How's that for an answer? One script, one activation. I've tried it. What happens is the last of the scripts takes over. You get two boxes, but only the final script runs. The first box remains empty.

     Well... that's it. The thing should be working provided you didn't alter the shape of the script or forget to activate it. I wish you good scrolling.

[The Script] [Placing It On Your Page]
[Activating The Script] [Go Faster!]