You are on page 1of 7

1.

JS Introduction
JavaScript Can Change HTML Content
JavaScript accepts both double and single quotes:
 document.getElementById("demo").innerHTML = "Hello JavaScript";
 document.getElementById('demo').innerHTML = 'Hello JavaScript';

JavaScript Can Change HTML Attribute Values

JavaScript Can Change HTML Styles (CSS)

JavaScript Can Hide HTML Elements

JavaScript Can Show HTML Elements


2. JavaScript Where To

The <script> Tag

JavaScript Functions and Events


JavaScript in <head> or <body>
JavaScript in <head>

JavaScript in <body>

External JavaScript
External References
uses a full URL to link to a script:

uses a script located in a specified folder on the current web site:

inks to a script located in the same folder as the current page:


3. JavaScript Output
Using innerHTML

Using document.write()

Using document.write() after an HTML document is loaded, will delete all existing HTML:

Using window.alert() / alert()

JavaScript Print
4. JavaScript Statements

Semicolons ;

When separated by semicolons, multiple statements on one line are allowed:

JavaScript White Space


JavaScript Line Length and Line Breaks

JavaScript Code Blocks


JavaScript Syntax

JavaScript Literals

JavaScript Variables

You might also like