Javascript Tutorial Part 1, Foreword, Making your first script.

April 16th, 2014


JavaScript is used on almost every website big and small. It can be used to move items, sense clicks, key types, addresses typed, and almost every other action on a website.

Basic HTML/CSS knowledge recommended beyond this point! I probably should have started with an HTML tutorial… Also, I am adding on to this as I learn so keep checking back for more.


Before we get into variables there are a few things you should know.

1. Most of the time code errors are caused by missing quotes(single ‘ or double”) or missing colons at the end of each line( ; ).

2. I highly recommend you to use an HTML editor such as Dreamweaver (Note, Dreamweaver costs!) so you can see errors in your code, and easily upload files to ftp.

3. When in doubt always check the JavaScript Console(Press F12, or right click, inspect element) for errors and more.

4. I don’t know why but JavaScript is generally written in the format lowerUpper for different words. JavaScript IS CasE SenSiTivE, so lowerupper is different than lowerUpper.

Making your first script.

All Java Scripts are either loaded directly in the pages source code, using <script> tags, or loaded externally(note that also uses <script> tags but in a different format).

For in-page loading(recommended if you are only going to be using your code for one page) you can begin as simply as this:

var message='This is a script';

As with all html(with an exception for <input>) don’t forget to close it with a /. If you do it like <script><script> it won’t work correctly.


For external loading(if you want to use on multiple pages), you would do it like this:

<script src="" ></script>

Where “src” = your source for the file. Again, don’t forget the closing </script> tag.

When making a .js file, you don’t need to use <script> tags in it, that will just mess it up.

You can add comments to your code, if you want to remember things, or want to keep code, but not run it. You can add comments like so:

var message = 'Why do people keep putting weird comments on these posts'; //seriously

Now that you know how to make your JavaScript load on a page, lets move on to the next part:



One thought on "Javascript Tutorial Part 1, Foreword, Making your first script."

  1. Medford says:

    I am totally wowed and prepared to take the next step now. Great Article.

Leave a Reply

Your email address will not be published. Required fields are marked *