Professional Documents
Culture Documents
INTRODUCTION –
PART 1
2
COURSE OUTLINE
Note:
<!DOCTYPE html> If you need a script to run as the
<html> page loads so that the script
<body> generates content in the page, then
<h2>My First JavaScript</h2> the script goes in the <body> portion
of the document. In this case, you
<script> would not have any function defined
document.write("hello world") using JavaScript. Take a look at the
</script> following code.
</body></html>
9
Note:
You can apply both method either alert
or document.write. The JS code can
be put anywhere in HTML file
10
JAVASCRIPT EXTERNAL FILES
This where the content The CSS enhance the This where we can change
of the page lives. The presentation of HTML page how the page behaves,
HTML gives the page with rules and state how the adding interactivity. Aim
structure and add HTML content is presented to keep as much as our
semantics(meaning) (background, border, box, JavaScript as possible in
dimension, color, fonts, etc) separate files
Source : javascriptbook.com
12
HOW HTML, CSS AND JAVASCRIPT FIT
TOGETHER
Source : javascriptbook.com
13
The HTML Page
Source : javascriptbook.com
14
HTML + CSS
Source : javascriptbook.com
15
HTML + CSS + JAVASCRIPT
Source : javascriptbook.com
16 WEB BROWSERS ARE PROGRAMS BUILT USING
OBJECTS
https://www.w3schools.com/
jsref/dom_obj_document.asp
17
▸ To do so, you have to find the elements first. There are a few
ways to do this:
CLICK HERE
27
getElementsByTagName : EXPLAINED
▸ Tip: You can use the length property of the NodeList object to
determine the number of child nodes with the specified tag name,
then you can loop through all nodes and extract the info you want.
CLICK HERE
31
HTML Object Collections
▸ document.anchors
▸ document.body
▸ document.documentElement
▸ document.embeds
▸ document.forms (!!)
▸ document.head
▸ document.images
▸ document.links
▸ document.scripts
▸ document.title
32
HTML Object Collections : document.forms
33
EXERCISE
▸ Exercise 1
▸ Exercise 2
▸ Exercise 3
▸ Exercise 4
34
CHANGING HTML
Output : Output :
35
EXAMPLE
Output :
36
EXERCISE
▸ EXERCISE 1
▸ EXERCISE 2
▸ EXERCISE 3
▸ EXERCISE 4
▸ EXERCISE 5
37
CHANGING CSS
▸ To change the style of an HTML element, use this syntax:
Output :
38
CHANGING CSS USING EVENT
▸ An element is clicked on
▸ The page has loaded
▸ Input fields are changed
39
CHANGING CSS USING EVENT
Before click
After click
▸ Exercise 1
▸ Exercise 2
▸ Exercise 3
▸ Exercise 4
▸ Exercise 5
41
THANKS!
Any questions?
42
Credits
Special thanks to all the people who made and released these
awesome resources for free:
▸ W3School
▸ Javascriptbook.com
▸ Presentation template by SlidesCarnival
▸ Photographs by Startupstockphotos