JavaScript Syntax

What does JavaScript syntax mean? JavaScript syntax refers to a set of rules that determine how the language will be written (by the programmer) and interpreted (by the browser). The JavaScript syntax is loosely based on the Java syntax. Java is a full blown programming environment and JavaScript could be seen as a sub-set of the Java syntax. Having said this, that is where the similarities end - Java and JavaScript are two totally different things.

In learning JavaScript you will become familiar with terms such as variables, functions, statements, operators, data types, objects etc. It will take most of this tutorial to show you the complete JavaScript syntax. For now, I'll give you a quick intro by showing you an example and explanation.
Read more…

How to enable JavaScript

To view webpages with JavaScript, you need to ensure your browser has JavaScript enabled. Generally speaking, you can still view the webpage without JavaScript, but you will not be able to take advantage of the JavaScript functionality.
How do I check if my browser has JavaScript enabled?

You normally do this by checking your browser's options. This will depend on the browser you're using. Instructions for some of the more common browsers are below:
Internet Explorer:

    Go to Tools from the top menu
    Select Internet Options
    Click on the Security tab
    Click Custom Level
    Scroll down until you see the Scripting section
    Ensure that the Active Scripting option is set at Enable
    When the Warning! window asks Are you sure you want to change the settings for this zone? click Yes

Mozilla Firefox

    Go to the Firefox menu
    Select Options
    Select the Content tab
    Check the Enable JavaScript checkbox
    Click OK to close the Options window

Google Chrome:

    Go to Chrome from the top menu
    Select Preferences...
    Click on Show advanced settings...
    Click on Content Settings...
    Ensure that the Allow all sites to run JavaScript (recommended) option is selected
    Click OK

Apple Safari:

    Go to Safari from the top menu
    Select Preferences
    Select Security
    Ensure that the Enable JavaScript option is checked
    Click OK

Opera:

    Go to Menu from the top menu
    Select Settings
    Select Quick Preferences
    Ensure that the Enable JavaScript option is checked

Netscape Navigator:

    Go to Edit from the top menu
    Select Preferences
    Select Advanced
    Select Scripts & Plugins
    Check the Enable JavaScript checkbox
    Click OK

Depending on your browser, the exact steps may differ slightly from above. Having said that, the above steps should point you in the right direction.

Note that you may need to refresh the page after enabling JavaScript before you see the effect.
How do I disable JavaScript?

You simply go through the steps above but ensure the JavaScript options are not checked/selected.

If you're developing web pages with JavaScript, it's good practice to view your website with JavaScript disabled. This will show you what your website will look like to users who choose to disable JavaScript.
Other browsers?

Most (if not all browsers) give you the option to enable/disable JavaScript. If your browser is not listed above, the steps above will give you some idea of how to find it. Just look for something called tools, options, preferences or something similar.
Warning

Java and JavaScript are two different things - make sure you're enabling/disabling the right option!
Read more…

JavaScript Introduction

What is JavaScript?

JavaScript is a scripting language that enables web developers/designers to build more functional and interactive websites.

Common uses of JavaScript include:

    Alert messages
    Popup windows
    Dynamic dropdown menus
    Form validation
    Displaying date/time

JavaScript usually runs on the client-side (the browser's side), as opposed to server-side (on the web server). One benefit of doing this is performance. On the client side, JavaScript is loaded into the browser and can run as soon as it is called. Without running on the client side, the page would need to refresh each time you needed a script to run.
What do I need to create JavaScript?

You can create JavaScript using the same equipment you use when creating HTML. That is:

    Computer
    Text editor. For example, Notepad (for Windows), Pico (for Linux), or Simpletext (Mac). You could use a HTML editor if you like but it's not needed.
    Web Browser. For example, Internet Explorer or Firefox. You will need to ensure JavaScript is enabled within your browser's settings (this is normally enabled by default).

The next lesson will show you how to enable/disable JavaScript in your browser.
Read more…