JavaScriptGuide


JavaScript - Client-side Scripting

JavaScript is the scripting language of the web!

JavaScript is used by millions of web pages to improve design, validate forms, detect browsers, create cookies, and many more applications.

JavaScript is easy to learn

JavaScript Examples

My First JavaScript Program

This is a paragraph




Try it Yourself »
Click the "Try it Yourself" button to view the online example.


What is JavaScript?

  • JavaScript was designed to add interactive behavior to HTML pages.
  • JavaScript is a scripting language (a scripting language is a lightweight programming language).
  • JavaScript is composed of several lines of executable computer code.
  • JavaScript is usually directly embedded in HTML pages.
  • JavaScript is an interpreted language (that is, code execution is performed without precompilation).
  • Everyone can use JavaScript without purchasing a license.

Client-side Scripting

JavaScript "dictates" browser behavior. This is called client-side scripting (or browser scripting).

Server-side scripting "dictates" server behavior (see the ASP/PHP tutorials on this site).


What can JavaScript do?

  • JavaScript provides a programming tool for HTML designers
    HTML authors are often not programmers, but JavaScript is a scripting language with extremely simple syntax! Almost everyone can put short snippets of code into their HTML pages.
  • JavaScript can put dynamic text into HTML pages
    A JavaScript statement like this can put a variable text into an HTML page: document.write("<h1>" + name + "</h1>")
  • JavaScript can respond to events
    JavaScript can be set to execute when a certain event occurs, such as when a page has finished loading or when a user clicks an HTML element.
  • JavaScript can read and write HTML elements
    JavaScript can read and change the content of HTML elements.
  • JavaScript can be used to validate data
    JavaScript can be used to validate data before it is submitted to a server.
  • JavaScript can be used to detect the visitor's browser
    JavaScript can be used to detect the visitor's browser, and based on the detected browser, load the corresponding page for that browser.
  • JavaScript can be used to create cookies
    JavaScript can be used to store and retrieve information located on the visitor's computer.

What is HTML DOM?

The HTML DOM defines a standard way to access and manipulate HTML documents.

The DOM expresses an HTML document as a tree structure.

HTML DOM Tree Example

DOM HTML tree



How to Learn JavaScript?

Visit the complete JavaScript tutorial

Visit the complete HTML DOM tutorial

Visit the complete JavaScript and HTML DOM reference manual

Other extensions