Pencarian

SEMOGA BERMANAFAAT UNTUK ANDA DAN KELUARGA...

Selasa, 18 Desember 2012

HTML Goodies: Script Tip: Week 1


 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>')

</SCRIPT>

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.

Tidak ada komentar:

Posting Komentar