September 19, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

So, You Want A Java Ticker Tape Script, Huh?

  • February 28, 2000
  • By Developer.com Staff
  • Send Email »
  • More Articles »

Special thanks to Bill Welliver, a computer student at Susquehanna University for taking the time to sit with me and explain every nuance of this script. Thanks Bill, you'll be called upon again!

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.
  • If you want to use this script, you must have at least Netscape browser version 2.02 or equivalent. If you don't, head to the Netscape Home Page and pick one up. The 2.02 browser works on Windows 3.x, W95, and MAC platforms.
  • This is not an applet! This is a script.
  • Bill Welliver and Cameron Gregory wrote and modified this script and have offered it to you. However, they ask that their names appear in the source code. If you follow my directions, you will do that.
  • This script has been known to crash Netscape. I've never seen it, but apparently it has. Take caution using it.
  • As always, you use this at your own risk. Neither Bill, Cameron, nor I will accept any responsibility for any crashing or other problems you experience.
  • I've gotten it to work consistently. You can, too!

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:
  • This page (you may want to save it first).
  • A text or HTML editor (whatever you use to write HTML).
  • The Java Ticker Tape script.

Here we go....
  • Open the text editor and start a new page. Mark it <HTML> and put up a full <TITLE>.
  • Open the Java Ticker Tape script, highlight it, and copy it.
  • Paste the entire script -- just as I presented it -- after the TITLE commands. This will ensure that you give Bill and Cameron credit. It's written right into the script.
    Please note: Do not add to the script. What words the ticker tape will scroll comes later. Hey! I told you not to touch it! I do and I do and I do for you and what thanks do I get?
  • Write the rest of your page as you would any page, remembering where you want the ticker to sit. For the sake of argument, this one will sit at the top like the ticker on this page does.

     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:

  • In the script it says "tt_speed=250". That tells the script how fast to scroll. Think of it as 250 ticks per minute. That's not exactly right, but it's a good way of judging speed. Lower numbers go faster -- higher numbers go slower.
  • In the script is says "tt_len=35". That's the size of the little window box that appears on your page. Play with it if you want.
  • You cannot change the scrolling text to bold or italic or make it bigger using this script. This script is a very simple scroll and you'd need a more fancy piece to play with the text.

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!]






Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel