Advanced webcoding: Javascript – Part 1


As promised (to some of you at least :’)) a few things about javascripting. Although I have to be honest with you here. I’m not that good with Javascript myself. But, I’ll try to explain you as good as I can.. And maybe even more important. As correct as I can.

Before continuing this series of tutorials, it’s important that you know how to code HTML and preferably also CSS. If you don’t, please take a look at my previous tutorials(Html 1, html 2, html 3, html 4, CSS 1, CSS 2, CSS 3, CSS 4).

Javascript, this is a scripting language used in HTML pages. Take note that this should not be confused with Java, both are very different.

There are quite a few things you can do with Javascript. For starters, it gives you the liberty to program a thing or two, which is not possible by only using HTML or CSS. You can make a script within your HTML code that reacts to certain events (like clicking a button).
Another nice thing you can do with Javascript (if you are a bit handy), is alter the content of your HTML page.
Depending on the conditions you can show a different text on your webpage.. How cool/nerdy is that?

One of the bigger problems with CSS is that not all the command are compatible with all browsers. With Javascript you can actually determine the type of browser the visitor is using. Once you know this, it’s possible to load a different page so all components stay functional.
The last, but not least, great feature (which comes to mind) is that Javascript can create cookies (yummy).

Just to be clear, Javascript is something that is implemented in your HTML code.
You can put it either in the HEAD tag or in the BODY tag. It doesn’t matter really… Best practice is to put all of your Javascript in the HEAD tag or at the bottom of your BODY tag. Like this all the code is on a central location. In case you need to start debugging it’s fairly easy to locate the code generating the error.

Next up some examples! ;)

Advertisements

One thought on “Advanced webcoding: Javascript – Part 1

  1. Pingback: Advanced webcoding: Javascript – Part 2: Variables « Tech-o-rama

Leave a Reply

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

%d bloggers like this: