What is Javascript and why do i need it?

Javascript is a programming language that operates important features on many websites.

//

I can’t access my HotMail account and it says on my log on page that i need Javascript to go any further. Just what is Javascript and why do i need it?

Well, the short answer is that Javascript is a programming language, and you need it because HotMail says you do.

I know, that’s not very helpful. Let’s see if I can explain in a little more detail.

Anything that happens on your computer happens because some kind of program tells your computer to do it. In fact, quite often it’s some kind of program telling some other kind of program to do it. It can get quite complicated, as you can imagine.

Take web pages, for example. Each web page is, essentially, a kind of computer program that tells your browser what to do. And, naturally, there are several different types of programming languages that can be used.

In (over) simplified terms:

HTML, or HyperText Markup Language, is the basic language of the web. It describes how a page should look. The browser follows the HTML instructions as it reads and presents the page. Once the page is complete, the browser’s done, and the HTML “program” is over.

DHTML, for Dynamic HTML, adds more programming constructs to HTML to create a way for the DHTML “program” to “do” things dynamically. For example with DHTML the web page can specify actions to be taken when certain events happen. A good example is what happens if you move the mouse over this sentence and see its color change from black to red.

Under ConstructionJavascript is not specifically HTML related, but interacts with HTML and DHTML when used in a browser. It’s a more traditional programming language, in that you can write a series of instructions to compute what kinds of actions should be taken based on various conditions, repeat things a variable number of times, and just generally take more complex and sophisticated actions. Small applications and games have been written entirely in Javascript.

The line between DHTML and Javascript can sometimes get blurry, but a rule of thumb I use is simple: DHTML is about the web page, period. The items on a web page, the events that a web page might want to act on (like moving your mouse over text), and the resulting changes to the web page that you might want to have happen resulting from those events (like changing the color of text). Javascript, however, is really web, and HTML, independent. It adds programming things like loops, and variables and functions. You could write a small program to calculate Pi in Javascript, and then perhaps use DHTML to do something interesting on the web page with it.

ActiveX is the next level up. It, too, represents a programming language, but in a different form. An ActiveX control is more like a “.EXE” or “.DLL” file on your computer. Much like that .EXE, it can be written in any programming language, but is “compiled” or transformed into your computer’s “machine” language before it gets distributed for use. ActiveX controls have the most power and speed, and represent the most danger. That’s why you’ll almost always want your browser to ask you before downloading and installing any ActiveX controls.

So in a nutshell, HTML, DHTML and Javascript are all programming languages that are used to make your web pages look and act the way we do.

Now, while HTML and DHTML are fundamental parts of your browser, Javascript, for various reasons can be turned off. But that doesn’t stop some sites from requiring it. HotMail being one big example. They’ve written portions of the HotMail interface using Javascript in order to provide their functionality. So in order to use HotMail, you must have Javascript enabled.

So the bottom line is that you need Javascript … because the websites you’re visiting have chosen to use it.

There are 13 comments:

  1. Greg Reply

    Worth noting is that one reason Javascript may be turned off is that it is also the language that was used to generate pop-ups and pop-unders. Some pop-up blockers block the actual Javascript event that opens the pop-up window, but others use a brute force approach by turning off Javascript altogether.

    Because Javascript has also been used for other nefarious purposes, like changing your homepage, some browsers block it by default, or require you to proactively approve letting a javascript run when you visit a page.

    Unfortunately, browser makers are still working on ways to allow us to enjoy the benefits of Javascript without being plagued by the annoyances. This is not a failing on their part so much as a problem with how functional Javascript is. The more it can do, the more it can be abused. And when we shut off an avenue for abuse, less ethical webmasters will just try to find new avenues.

  2. Margie Reply

    I’m on AOL & tried to register a product. I got a pop up that says you must have JAVASCRIPT to be able to do this function.I’ve registered other products & never got a message like that. What should I do ? Download it.

  3. Lingeswara Rao Amaraneni Reply

    Sir ,
    May I know what is Java script and why do I need it.I knew HTML..

  4. Leo Notenboom Reply

    You may. Simply read the article you just commented on.

  5. David M Mazon Reply

    I deleted Java because I was told I don’t need it and now I’m told I need Javascript. How do I get it and where do I download it to. Selections are confusing.

  6. Jim Reply

    Very informative. I dropped Java from a small laptop simply to save memory space. However, it will be interesting to note when I receive any notice of its need.

  7. robert Reply

    Do I need to keep all the previous updates for Java on my computer ? Do the updates over ride previous updates so that I can delete the previous updates which take a lot of MB space on my computer ?

  8. Patricia Reply

    Would Javascript alter my own web pages.
    The colour of the text has changed from black to red,blue and black.
    Also I can no longer alter my web pages.
    Can you Help me with this problem, I don’t know who else to ask.

    Regards Patricia

  9. Bernard Winchester Reply

    Thank you for an informative article.

    I too have been confused about Java and Javascript. My limited understanding is that they are not directly related, although Sun Microsystems are in charge of both. Also, as I understand it, Javascript is incorporated in all reasonably modern browsers and can generally be turned on or off in the Security settings.

    I certainly would like to know more about Java, such as to what extent it is included in browsers, and how necessary is the full download as opposed to, say, the smaller Microsoft Java Virtual Machine, which is still obtainable if no longer supported by MS.

  10. Glenn Reply

    Thanks for defogging tricky Java. And a BIG thanks for continuing with Ask Leo. You’re the gold standard.

  11. Christine Parr (Mrs) Reply

    Would you kindly take steps and get this problem sorted out. I like to play Bubbles IQ and Wordz IQ and have been doing so without any problem for several months now all of a sudden I find that I need Javascript enabling. How come this has not been an issue until now? I want to play these two games again so can you please let me know how to enable Javascript because as far as I know, I did not have it before. HELP NEEDED NOW! I see that I am not the only person affected and I suspect that they are all as angry and disappointed as I am. Let us know how to get our favourite games back again.

Leave a reply:

Before commenting please:

  • Read the article. Seriously. You'd be shocked at how many people make comments that prove they didn't.
  • Comment only on the article. If you have a new, unrelated question start with the search box at the top of the page.
  • Don't post personal information. Email addresses, phone numbers and such will be removed.

VERY IMPORTANT: because of a rise in comment spam that's making it through our filters any comments that do not add to the discussion - typically off topic or content-free comments - run a very high risk of being flagged as spam and removed.

If you have a new question unrelated to the article above, ask it on the Ask Leo! ask-a-question page.