0% found this document useful (0 votes)
4 views13 pages

JS Lesson1

This document provides an introduction to JavaScript, a programming language used for designing websites that can manipulate HTML and CSS. It outlines the requirements for using JavaScript, including a text editor and a browser, and explains where to place JavaScript code within HTML documents. The document also includes examples of using JavaScript in the body and head sections of HTML, as well as using external scripts.

Uploaded by

senpainapster
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views13 pages

JS Lesson1

This document provides an introduction to JavaScript, a programming language used for designing websites that can manipulate HTML and CSS. It outlines the requirements for using JavaScript, including a text editor and a browser, and explains where to place JavaScript code within HTML documents. The document also includes examples of using JavaScript in the body and head sections of HTML, as well as using external scripts.

Uploaded by

senpainapster
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

JavaScript

Tutorials
Part 1: An Introduction
What’s in?
1. What is JavaScript?
2. What are the Requirements?
3. How do we use JavaScript?
JavaScript
Is a programming language for
designing websites. It can
manipulate both HTML and CSS
JavaScript
It can perform logical checks,
calculation, modify existing HTML
and CSS codes and more.
JavaScript
It is the most populat
programming language as of the
moment.
Requirements
1. Text Editor
2. Browser
Text Editor
Browser
Where to place JavaScript?
1. Script inside the BODY section
2. Script inside the HEAD section
3. External Script
Script inside the Body Section
<!DOCTYPE html>
<html>
<body>
<h2>Demo JavaScript in Body</h2>
<p id="demo">A Paragraph</p>
<button type="button" onclick="myFunction()">Try it</button>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Paragraph
changed.";
}
</script>
</body>
</html>
Script inside the Head Section
<!DOCTYPE html>
<html>
<head>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Paragraph
changed.";
}
</script>
</head>
<body><h2>Demo JavaScript in Head</h2>
<p id="demo">A Paragraph</p>
<button type="button" onclick="myFunction()">Try it</button>
</body>
</html>
External Script
<!DOCTYPE html>
<html>
<head> function myFunction() {
<script src=“script.js”> document.getElementById("demo"
</script> ).innerHTML = "Paragraph
</head> changed.";
<body><h2>External }
JavaScript</h2>
<p id="demo">A Paragraph</p>
<button type="button" onclick=
"myFunction()">Try it</button>
</body>
</html>

HTML file JS file


Thank
You

You might also like