Introduction
Explore the fundamentals of JavaScript, a versatile scripting language for web development.
Agenda
- Introduction to JavaScript.
- What JavaScript can do?
- Where to insert JavaScript?
- General rules in writing JavaScript.
- Displaying output using JavaScript.
- JavaScript comments.
JavaScript
JavaScript is a scripting language that allows users to implement complex features on web pages.
JavaScript allows users to:
- Store useful values inside variables.
- Perform operations on pieces of text.
- Run codes in response to certain events occurring on a web page.
JavaScript and Java are completely different languages, both in concept and design.
JavaScript was invented by Brendan Eich in 1995 and became an ECMA (European Computer Manufacturers Association) standard in 1997.
ECMA-262 is the official name of the standard and ECMAScript is the official name of the language.
Why Study JavaScript
JavaScript is one of the 3 languages all web developers must learn:
- HTML to define the content of web pages.
- CSS to specify the layout of web pages.
- JavaScript to program the behavior of web pages.
What JavaScript do?
Change the HTML content
One of many JavaScript HTML methods is getElementById()
.
This example uses the method to "find" an HTML element (with id="demo"
) and changes the element content (innerHTML) to "Hello JavaScript":
Change the HTML attribute values
Can change HTML styles (CSS)
Last updated on