Scripting code: It’s not as hard as it looks

You can mess up, but the beautiful thing is: if the browser doesn’t know what you’re asking for, it ignores it. No crashing!

Recently, I’ve been working on web pages. That’s something I’ve never done before, at least not the correct way. I used to think I had to layout a website with tables. I had no idea xml format was so easy. I was missing out on the power and simplicity of the web. All those cool websites you see? Yes, you can do them to.

There are three simply languages you need to know about: HTML, CSS, and Javascript, all of which can be written in a text file and saved with the proper extension ( .html .css and .js respectively). Also, there’s Java, but I’ll discuss later why you won’t need to learn it. I call the first two languages “simple” because you can do most anything you want with fairly few commands. Javascript, however, is simple only with respect to C++ and Java programmers. More on that later.

Before you jump the gun, I recommend looking into an IDE (integrated development environment) called Bluefish.

HTML (HyperText Markup Language)

Your browser is running HTML code right now. Actually, all it’s really doing is reading a text file that says “<!DOCTYPE html>” at the top (or something like that).

All commands in HTML are formatted as XML style “tags”, which simply means that if you have a command, say “command”, using it looks like this:

<command>some text</command>

That’s it. Aside from the <!DOCTYPE html> and some comments, the rest of your document will be enclosed in html tags, which means:

<html> all your stuff </html>

Tutorial at W3Schools, although I probably would recommend this only for people with past coding experience. For reference, read up on it at the HTML Code Tutorial website.

Once again, to make it easy for yourself, use the Bluefish IDE for syntax highlighting and code completion.

CSS (Cascading Style Sheets)

Up until HTML 4, CSS did not exist and there was no real way of formatting your website. But with CSS, you can set up those borders and such on your website easily. Basically, you set up fields that hold commands for how to treat the stuff in them.

The key commands you need to know about: “position”, “left”, “right”, “top”, “bottom”, “width”, “height”, and “background”.

Yes, use Bluefish IDE for syntax highlighting and code completion. It also has documentation in it to tell you what these commands do.

Javascript

If you’ve ever programmed in C++, you’ll feel almost right at home in Javascript. The different, of course, is that you don’t have the standard library to go with it. But that’s fine when you have the other benefits of scripting languages, such as the fact that all of your variables are universal data type (that is, they can store any data type).

Key commands to look up: document.write() and document.getElementById()

W3Schools has a tutorial for Javascript, though I recommend having taken a course in C++ first to get an idea of how to write in this language. Also, Bluefish IDE will do syntax highlighting.

Java

I mention Java here because you can create Applets with it. Do realize, however, that not everyone has Java for their browser. Why use Java then? Well, Java can do a whole lot more than Javascript. Plus, Java is easier to maintain code-wise than Javascript. However, if you don’t use the built-in libraries in Java, you’ll have to write everything from the ground up, whereas Javascript won’t even let you (use what’s built-in). Javascript trumps Java in the fact that it has built-in one-line commands that do a ton of work for handling user interaction, which is very handy.

Conclusion

Now that’s not so bad is it? Go ahead and give scripting a try. Eventually, you too can have your own website up and showing. There are plenty of free places to host as well. Try out 000webhost or webs.com.

Links

Advertisements

About chronologicaldot

Just a Christ-centered, train-loving, computer geek.
This entry was posted in software and tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , . Bookmark the permalink.

Enter the space and time of my little world... Welcome Earthling.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s