HTML Goodies: Script Tip: Week 1

By Joe Burns

Tip One

JavaScript is a great computer language in that it is quite versatile and can be understood by the common Weekend Silicon Warrior. Here, we start off a series of tips to help you place JavaScript on your HTML pages.

We'll start with the basics. JavaScript offers the user a series of what it calls "objects." These are things that already exist without having to be created through scripting. This HTML page you're looking at is, in my opinion, the most commonly used object. In JavaScript speak, the page is named "document."

Okay, fine. You have an object, so what? Well, now you get to act upon it. These things that JavaScript uses to act upon "object" are called "methods." You can always tell a method by its tail. Every method has this at the end: ().

     Those two parentheses denote the method and hold instructions on what should happen. For instance:

<SCRIPT LANGUAGE="javascript">
document.write('<FONT COLOR=green>Green Text</FONT>')

That script will produce this: Green Text

See what's happening? The document is being acted upon by the method "write." Inside the ( and the ) is what should be written to the page. In this case, green text.

You don't get a much more simple JavaScript than the one above. All it does is use scripting to place text upon the page. Whatever is in between those parentheses is written to the page. It's a very simple hierarchy statement.

Next Week: What do you mean by "hierarchy statement?"

     Do YOU have a Script Tip you'd like to share? How about suggesting a Script Tip to write about? I'd love to hear it. Write me at: webmaster@htmlgoodies.com

Learn to write your own JavaScripts with the
HTML Goodies 30-Step Primer Series
and take the knowledge home with you in
JavaScript Goodies!

You can find many other uses for JavaScript
on your Web pages here!

  • Web Development Newsletter Signup

    Invalid email
    You have successfuly registered to our newsletter.
Thanks for your registration, follow us on our social networks to keep up-to-date