By itself, HTML is a language with limited power. You use it to describe the static structure of your content. When the browser renders plain HTML, the content is inert and passively consumed by the viewer. With CSS, you may add a bit of life to your static content through media queries, animations, and styles that are triggered by clicking and hovering. To achieve true dynamic behavior, however, you need a scripting language.
With a scripting language, you may:
It was 1995. The web was becoming the "un-desktop," a place where organizations and individuals shared things that didn't depend on a particular operating system. The web was rising fast and so was Netscape, the most popular browser of the time. Microsoft feared missing out on the new opportunities brought on by the web and was triggered into developing Internet Explorer. Meanwhile, Sun Microsystems had just abandoned the world of smart appliances and decided to make Java a language for applications served out on the web. The same Java bytecode could run on any computer with a Java virtual machine, which fit nicely into the idea of the web as a neutral platform. To combat the looming Microsoft, Netscape and Sun decided to join forces.