SlideShare uma empresa Scribd logo
1 de 31
Copyright © Terry Felke-Morris
WEB DEVELOPMENT & DESIGN
FOUNDATIONS WITH HTML5
Chapter 14
Key Concepts
1Copyright © Terry Felke-Morris
Copyright © Terry Felke-Morris
LEARNING OUTCOMES
 In this chapter, you will learn how to:
 Describe common uses of JavaScript in web pages.
 Describe the purpose of the Document Object Model
and list some common events.
 Create a simple JavaScript using the script element and
the alert() method.
 Use variables, operators and the if control structure.
 Create a basic form validation script.
2
Copyright © Terry Felke-Morris
WHAT IS JAVASCRIPT?
 Object-based scripting language
 Works with the objects associated with a
Wwb page document
 the window
 the document
 the elements
 such as forms, images, hyperlinks, etc
3
Copyright © Terry Felke-Morris
WHAT IS JAVASCRIPT?
 Originally developed by Netscape
 Named LiveScript
 Netscape & Sun Microsystems Collaboration
 LiveScript renamed JavaScript
 JavaScript is NOT Java
4
Copyright © Terry Felke-Morris
COMMON USES OF JAVASCRIPT
 Display a message box
 Select list navigation
 Edit and validate form information
 Create a new window with a specified size and
screen position
 Image Rollovers
 Status Messages
 Display Current Date
 Calculations
5
Copyright © Terry Felke-Morris
CODING JAVASCRIPT
 JavaScript statements can be coded on a web page
using two different techniques:
 Place JavaScript code between <script> tags
 Place JavaScript code as part of an event attached to an
HTML element
6
Copyright © Terry Felke-Morris
JAVASCRIPT: USING THE SCRIPT ELEMENT
The script element
◦ A container tag
◦ May be placed in either the head or the body
section of a web page
<script type="text/javascript">
<!- -
alert("Welcome to Our Site");
// - ->
</script>
7
Copyright © Terry Felke-Morris
CHECKPOINT
1. Describe at least three popular uses for
JavaScript.
2. How many JavaScript code blocks can be
embedded in an HTML document?
3. Describe a method that can be used to find an
error in a JavaScript code block.
8
Copyright © Terry Felke-Morris
DOCUMENT OBJECT MODEL (DOM)
A portion of the
DOM is shown at the
left.
Defines every object
and element on a web
page
Hierarchical structure
Accesses page
elements and apply
styles to page
elements
9
Copyright © Terry Felke-Morris
OBJECT
 An object is a thing or entity.
 Browser window
 Submit button
 Web page document
10
Copyright © Terry Felke-Morris
PROPERTY
 A property is a characteristic or attribute of an
object.
 The background color of a web page document
document.bgcolor
 The date the web page file was last modified
document.lastmodified
 The src file of an image object
image1.src
11
Copyright © Terry Felke-Morris
METHOD
 A method is an action (a verb)
 Writing text to a web page document
document.write()
 Submitting a form
form1.submit()
12
Copyright © Terry Felke-Morris
JAVASCRIPT AND EVENTS
Events:
actions taken by the web page visitor
◦ clicking (onclick),
◦ placing the mouse on an element (onmouseover),
◦ removing the mouse from an element (onmouseout),
◦ loading the page (onload),
◦ unloading the page (onunload), etc.
13
EVENTS
Event Event Handler
click onclick
load onload
mouseover onmouseover
mouseout onmouseout
submit onsubmit
unload onunload
14
Copyright © Terry Felke-Morris
JAVASCRIPT AND EVENTS
 JavaScript can be configured to perform actions when
events occur.
 The event name is coded as an attribute of an HTML tag
 The value of the event attribute contains the JavaScript code
Example:
Display an alert box when the mouse is placed over a
hyperlink.
15
<a href="home.htm" onmouseover="alert('Click to go home')">Home</a>
Copyright © Terry Felke-Morris
JAVASCRIPT DEBUGGING(1)
Check the syntax of the statements
◦ Pay very close attention to upper and lower case letters, spaces, and quotations
Verify that you have saved the page with your most recent changes
Verify that you are testing the most recent version of the page
(refresh or reload the page)
If you get an error message, use the error messages that are
displayed by the browser
◦ In Firefox: Select Tools > Error Console
16
Copyright © Terry Felke-Morris
JAVASCRIPT DEBUGGING(2)
 Use the Firefox browser:
 Select Tools > Error Console from the Menu
 The Error Console will indicate an issue and the line number
 This may not be exactly where the problem is
 Sometimes the error is a one or two lines above the indicated line
number.
17
Copyright © Terry Felke-Morris
CHECKPOINT
1. With respect to objects, describe the difference between a
property and a method. Feel free to use words like “thing,”
“action,”“description,”“attribute,” and so forth.
2. What is the difference between an event and an event
handler?
3. Where are event handlers placed in the HTML document?
18
Copyright © Terry Felke-Morris
VARIABLE
 A variable is a placeholder for information.
 The variable is stored in the computer’s memory
(RAM).
var userName;
userName = "Karen";
document.write(userName);
19
Copyright © Terry Felke-Morris
PROMPTS
 prompt() method
 Displays a message and accepts a value from the user
myName = prompt(“prompt message”);
 The value typed by the user is stored in the variable
myName
20
ARITHMETIC OPERATORS
Operat
or
Description Example Value of
Quantity
= assign quantity = 10 10
+ addition quantity = 10 + 6 16
- subtraction quantity = 10 - 6 4
* multiplication quantity = 10 * 2 20
/ division quantity = 10 / 2 5
21
COMPARISON OPERATORS
Operator Description Example Sample values of quantity
that would result in true
= = Double equals
sign
(equivalent)
“is exactly
equal to”
quantity = = 10 10
> Greater than quantity > 10 11, 12 (but not 10)
> = Greater than
or equal to
quantity > = 10 10, 11, 12
< Less than quantity < 10 8, 9 (but not 10)
< = Less than or
equal to
quantity < = 10 8, 9, 10
! = Not equal to quantity ! = 10 8, 9, 11 (but not 10)
22
Copyright © Terry Felke-Morris
DECISION MAKING
if (condition) {
… commands to execute if condition is true
}
else {
… commands to execute if condition is false
}
23
Copyright © Terry Felke-Morris
FUNCTION
 A function is a block of one or more JavaScript
statements with a specific purpose, which can be
run when needed.
function function_name() {
... JavaScript statements …
}
24
Copyright © Terry Felke-Morris
USING FUNCTIONS
function showAlert() {
alert("Please click OK to continue.");
}
25
Calling the Function
showAlert();
Defining the Function
Copyright © Terry Felke-Morris
CHECKPOINT
1. Describe a method that can be used to gather a piece of data such as
the user’s age.
2. Write the JavaScript code to display an alert message for users who
are under 18 years old and a different alert message for users who
are 18 years or older.
3. What is a function definition?
26
Copyright © Terry Felke-Morris
FORMVALIDATION
 It is common to use JavaScript to validate form
information before submitting it to the web server.
 Is the name entered?
 Is the e-mail address of correct format?
 Is the phone number in the correct format?
 See Hands-on Practice 14.8
27
Copyright © Terry Felke-Morris
VALIDATING FORM FIELDS
 Use the "" or null to check to determine if a
form field has information
if (document.forms[0].userName.value == "" ) {
alert("Name field cannot be empty.");
return false;
} // end if
28
Copyright © Terry Felke-Morris
JAVASCRIPT & ACCESSIBILITY
 Don’t expect JavaScript to always function for
every visitor
 Some may have JavaScript disabled
 Some may be physically unable to click a mouse
 Provide a way for your site to be used if JavaScript
is not functioning
 Plain text links
 E-mail contact info
29
Copyright © Terry Felke-Morris
CHECKPOINT
1. What is meant by the term “form data validation”?
2. Give three examples of form data that may require
validation.
3. Should you always expect your JavaScript to “work” –
why or why not?
30
Copyright © Terry Felke-Morris
SUMMARY
This chapter introduced the use of JavaScript on
web pages.
Topics included:
 Common uses of JavaScript in web pages.
 The purpose of the Document Object Model
 The script element
 The alert() method
 Use variables, operators and the if control structure.
 Configure functions
 Using JavaScript to validate a form
31

Mais conteúdo relacionado

Mais procurados

How websites and search engines work
How websites and search engines workHow websites and search engines work
How websites and search engines workBrian Duffy
 
Basics of css and xhtml
Basics of css and xhtmlBasics of css and xhtml
Basics of css and xhtmlsagaroceanic11
 
WordPress HTML, CSS & Child Themes
WordPress HTML, CSS & Child ThemesWordPress HTML, CSS & Child Themes
WordPress HTML, CSS & Child ThemesMichelle Ames
 
An Introduction to HTML5
An Introduction to HTML5An Introduction to HTML5
An Introduction to HTML5Steven Chipman
 
Posterous Guide: The Easy Way to Blog
Posterous Guide: The Easy Way to BlogPosterous Guide: The Easy Way to Blog
Posterous Guide: The Easy Way to BlogDeborah Edwards-Onoro
 
APEX navigation concepts
APEX navigation conceptsAPEX navigation concepts
APEX navigation conceptsTobias Arnhold
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5IT Geeks
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationSean Burgess
 
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateBlog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateSean Burgess
 
IBM Connections mail with exchange backend
IBM Connections mail with exchange backendIBM Connections mail with exchange backend
IBM Connections mail with exchange backendmichele buccarello
 
Intro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniterIntro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniterbrightrocket
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginnersSingsys Pte Ltd
 

Mais procurados (20)

Chapter11
Chapter11Chapter11
Chapter11
 
Chapter10
Chapter10Chapter10
Chapter10
 
Chapter5
Chapter5Chapter5
Chapter5
 
Chapter1
Chapter1Chapter1
Chapter1
 
Chapter3
Chapter3Chapter3
Chapter3
 
How websites and search engines work
How websites and search engines workHow websites and search engines work
How websites and search engines work
 
Chapter4
Chapter4Chapter4
Chapter4
 
Basics of css and xhtml
Basics of css and xhtmlBasics of css and xhtml
Basics of css and xhtml
 
WordPress HTML, CSS & Child Themes
WordPress HTML, CSS & Child ThemesWordPress HTML, CSS & Child Themes
WordPress HTML, CSS & Child Themes
 
An Introduction to HTML5
An Introduction to HTML5An Introduction to HTML5
An Introduction to HTML5
 
Posterous Guide: The Easy Way to Blog
Posterous Guide: The Easy Way to BlogPosterous Guide: The Easy Way to Blog
Posterous Guide: The Easy Way to Blog
 
APEX navigation concepts
APEX navigation conceptsAPEX navigation concepts
APEX navigation concepts
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
Intro to html 5
Intro to html 5Intro to html 5
Intro to html 5
 
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD CombinationLotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
Lotusphere 2012 Speedgeeking - jQuery & Domino, a RAD Combination
 
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog TemplateBlog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
Blog It Up, Baby! Extending the new IBM Lotus Domino Blog Template
 
IBM Connections mail with exchange backend
IBM Connections mail with exchange backendIBM Connections mail with exchange backend
IBM Connections mail with exchange backend
 
Internet Librarian Slides
Internet Librarian SlidesInternet Librarian Slides
Internet Librarian Slides
 
Intro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniterIntro to ExpressionEngine and CodeIgniter
Intro to ExpressionEngine and CodeIgniter
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginners
 

Semelhante a Chapter 14 - Web Design

Introduction to apex code
Introduction to apex codeIntroduction to apex code
Introduction to apex codeEdwinOstos
 
Lt web quiz_answer
Lt web quiz_answerLt web quiz_answer
Lt web quiz_answer0983676660
 
Building appsinsilverlight4 part_1
Building appsinsilverlight4 part_1Building appsinsilverlight4 part_1
Building appsinsilverlight4 part_1Dennis Perlot
 
20150812 4시간만에 따라해보는 windows 10 앱 개발
20150812  4시간만에 따라해보는 windows 10 앱 개발20150812  4시간만에 따라해보는 windows 10 앱 개발
20150812 4시간만에 따라해보는 windows 10 앱 개발영욱 김
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Jonas Follesø
 
R Tanenbaum .Net Portfolio
R Tanenbaum .Net PortfolioR Tanenbaum .Net Portfolio
R Tanenbaum .Net PortfolioRobert Tanenbaum
 
Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium Peyman Fakharian
 
MSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF DemystifiedMSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF DemystifiedDave Bost
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />tutorialsruby
 
php-mysql-tutorial-part-3
php-mysql-tutorial-part-3php-mysql-tutorial-part-3
php-mysql-tutorial-part-3tutorialsruby
 
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/tutorialsruby
 
php-mysql-tutorial-part-3
php-mysql-tutorial-part-3php-mysql-tutorial-part-3
php-mysql-tutorial-part-3tutorialsruby
 
Best Practices & Lessons Learned from the field on EMC Documentum xCP 2.0
Best Practices & Lessons Learned from the field on EMC Documentum xCP 2.0Best Practices & Lessons Learned from the field on EMC Documentum xCP 2.0
Best Practices & Lessons Learned from the field on EMC Documentum xCP 2.0Haytham Ghandour
 
Ethical hacking Chapter 10 - Exploiting Web Servers - Eric Vanderburg
Ethical hacking   Chapter 10 - Exploiting Web Servers - Eric VanderburgEthical hacking   Chapter 10 - Exploiting Web Servers - Eric Vanderburg
Ethical hacking Chapter 10 - Exploiting Web Servers - Eric VanderburgEric Vanderburg
 
Using Page Objects
Using Page ObjectsUsing Page Objects
Using Page ObjectsGetch88
 
Access tips access and sql part 4 building select queries on-the-fly
Access tips  access and sql part 4  building select queries on-the-flyAccess tips  access and sql part 4  building select queries on-the-fly
Access tips access and sql part 4 building select queries on-the-flyquest2900
 
Building Accessible Apps using NET MAUI.pdf
Building Accessible Apps using NET MAUI.pdfBuilding Accessible Apps using NET MAUI.pdf
Building Accessible Apps using NET MAUI.pdfSivarajAmbat1
 
The Taming Of The Code
The Taming Of The CodeThe Taming Of The Code
The Taming Of The CodeAlan Stevens
 
Java script basics
Java script basicsJava script basics
Java script basicsJohn Smith
 

Semelhante a Chapter 14 - Web Design (20)

Introduction to apex code
Introduction to apex codeIntroduction to apex code
Introduction to apex code
 
Lt web quiz_answer
Lt web quiz_answerLt web quiz_answer
Lt web quiz_answer
 
Building appsinsilverlight4 part_1
Building appsinsilverlight4 part_1Building appsinsilverlight4 part_1
Building appsinsilverlight4 part_1
 
20150812 4시간만에 따라해보는 windows 10 앱 개발
20150812  4시간만에 따라해보는 windows 10 앱 개발20150812  4시간만에 따라해보는 windows 10 앱 개발
20150812 4시간만에 따라해보는 windows 10 앱 개발
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
 
ASP.NET MVC3 RAD
ASP.NET MVC3 RADASP.NET MVC3 RAD
ASP.NET MVC3 RAD
 
R Tanenbaum .Net Portfolio
R Tanenbaum .Net PortfolioR Tanenbaum .Net Portfolio
R Tanenbaum .Net Portfolio
 
Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium
 
MSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF DemystifiedMSDN Unleashed: WPF Demystified
MSDN Unleashed: WPF Demystified
 
&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />&lt;img src="../i/r_14.png" />
&lt;img src="../i/r_14.png" />
 
php-mysql-tutorial-part-3
php-mysql-tutorial-part-3php-mysql-tutorial-part-3
php-mysql-tutorial-part-3
 
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
&lt;b>PHP&lt;/b>/MySQL &lt;b>Tutorial&lt;/b> webmonkey/programming/
 
php-mysql-tutorial-part-3
php-mysql-tutorial-part-3php-mysql-tutorial-part-3
php-mysql-tutorial-part-3
 
Best Practices & Lessons Learned from the field on EMC Documentum xCP 2.0
Best Practices & Lessons Learned from the field on EMC Documentum xCP 2.0Best Practices & Lessons Learned from the field on EMC Documentum xCP 2.0
Best Practices & Lessons Learned from the field on EMC Documentum xCP 2.0
 
Ethical hacking Chapter 10 - Exploiting Web Servers - Eric Vanderburg
Ethical hacking   Chapter 10 - Exploiting Web Servers - Eric VanderburgEthical hacking   Chapter 10 - Exploiting Web Servers - Eric Vanderburg
Ethical hacking Chapter 10 - Exploiting Web Servers - Eric Vanderburg
 
Using Page Objects
Using Page ObjectsUsing Page Objects
Using Page Objects
 
Access tips access and sql part 4 building select queries on-the-fly
Access tips  access and sql part 4  building select queries on-the-flyAccess tips  access and sql part 4  building select queries on-the-fly
Access tips access and sql part 4 building select queries on-the-fly
 
Building Accessible Apps using NET MAUI.pdf
Building Accessible Apps using NET MAUI.pdfBuilding Accessible Apps using NET MAUI.pdf
Building Accessible Apps using NET MAUI.pdf
 
The Taming Of The Code
The Taming Of The CodeThe Taming Of The Code
The Taming Of The Code
 
Java script basics
Java script basicsJava script basics
Java script basics
 

Mais de tclanton4

Chapter 12 - Web Design
Chapter 12 - Web DesignChapter 12 - Web Design
Chapter 12 - Web Designtclanton4
 
Chapter 11 - Web Design
Chapter 11 - Web DesignChapter 11 - Web Design
Chapter 11 - Web Designtclanton4
 
Chapter 8 - Web Design
Chapter 8 - Web DesignChapter 8 - Web Design
Chapter 8 - Web Designtclanton4
 
Chapter 6 - Web Design
Chapter 6 - Web DesignChapter 6 - Web Design
Chapter 6 - Web Designtclanton4
 
Chapter 5 - Web Design
Chapter 5 - Web DesignChapter 5 - Web Design
Chapter 5 - Web Designtclanton4
 
Chapter 4 - Web Design
Chapter 4 - Web DesignChapter 4 - Web Design
Chapter 4 - Web Designtclanton4
 
Chapter 3 - Web Design
Chapter 3 - Web DesignChapter 3 - Web Design
Chapter 3 - Web Designtclanton4
 
Chapter 1 - Web Design
Chapter 1 - Web DesignChapter 1 - Web Design
Chapter 1 - Web Designtclanton4
 
Charts in Calc
Charts in CalcCharts in Calc
Charts in Calctclanton4
 
Formatting a Worksheet in Calc
Formatting a Worksheet in CalcFormatting a Worksheet in Calc
Formatting a Worksheet in Calctclanton4
 
Creating a Worksheet in Calc
Creating a Worksheet in CalcCreating a Worksheet in Calc
Creating a Worksheet in Calctclanton4
 
Advanced Features of Writer
Advanced Features of WriterAdvanced Features of Writer
Advanced Features of Writertclanton4
 
Creating a Writer Document
Creating a Writer DocumentCreating a Writer Document
Creating a Writer Documenttclanton4
 
Formatting Features of Writer
Formatting Features of WriterFormatting Features of Writer
Formatting Features of Writertclanton4
 
Getting Started - The Basics
Getting Started - The BasicsGetting Started - The Basics
Getting Started - The Basicstclanton4
 
Intro to Information Systems
Intro to Information SystemsIntro to Information Systems
Intro to Information Systemstclanton4
 

Mais de tclanton4 (20)

Chapter 12 - Web Design
Chapter 12 - Web DesignChapter 12 - Web Design
Chapter 12 - Web Design
 
Chapter 11 - Web Design
Chapter 11 - Web DesignChapter 11 - Web Design
Chapter 11 - Web Design
 
Chapter 8 - Web Design
Chapter 8 - Web DesignChapter 8 - Web Design
Chapter 8 - Web Design
 
Chapter 6 - Web Design
Chapter 6 - Web DesignChapter 6 - Web Design
Chapter 6 - Web Design
 
Chapter 5 - Web Design
Chapter 5 - Web DesignChapter 5 - Web Design
Chapter 5 - Web Design
 
Chapter 4 - Web Design
Chapter 4 - Web DesignChapter 4 - Web Design
Chapter 4 - Web Design
 
Chapter 3 - Web Design
Chapter 3 - Web DesignChapter 3 - Web Design
Chapter 3 - Web Design
 
Chapter 1 - Web Design
Chapter 1 - Web DesignChapter 1 - Web Design
Chapter 1 - Web Design
 
Base2
Base2Base2
Base2
 
Base1
Base1Base1
Base1
 
Impress
ImpressImpress
Impress
 
Project Mgt
Project MgtProject Mgt
Project Mgt
 
Charts in Calc
Charts in CalcCharts in Calc
Charts in Calc
 
Formatting a Worksheet in Calc
Formatting a Worksheet in CalcFormatting a Worksheet in Calc
Formatting a Worksheet in Calc
 
Creating a Worksheet in Calc
Creating a Worksheet in CalcCreating a Worksheet in Calc
Creating a Worksheet in Calc
 
Advanced Features of Writer
Advanced Features of WriterAdvanced Features of Writer
Advanced Features of Writer
 
Creating a Writer Document
Creating a Writer DocumentCreating a Writer Document
Creating a Writer Document
 
Formatting Features of Writer
Formatting Features of WriterFormatting Features of Writer
Formatting Features of Writer
 
Getting Started - The Basics
Getting Started - The BasicsGetting Started - The Basics
Getting Started - The Basics
 
Intro to Information Systems
Intro to Information SystemsIntro to Information Systems
Intro to Information Systems
 

Último

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 

Último (20)

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 

Chapter 14 - Web Design

  • 1. Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1Copyright © Terry Felke-Morris
  • 2. Copyright © Terry Felke-Morris LEARNING OUTCOMES  In this chapter, you will learn how to:  Describe common uses of JavaScript in web pages.  Describe the purpose of the Document Object Model and list some common events.  Create a simple JavaScript using the script element and the alert() method.  Use variables, operators and the if control structure.  Create a basic form validation script. 2
  • 3. Copyright © Terry Felke-Morris WHAT IS JAVASCRIPT?  Object-based scripting language  Works with the objects associated with a Wwb page document  the window  the document  the elements  such as forms, images, hyperlinks, etc 3
  • 4. Copyright © Terry Felke-Morris WHAT IS JAVASCRIPT?  Originally developed by Netscape  Named LiveScript  Netscape & Sun Microsystems Collaboration  LiveScript renamed JavaScript  JavaScript is NOT Java 4
  • 5. Copyright © Terry Felke-Morris COMMON USES OF JAVASCRIPT  Display a message box  Select list navigation  Edit and validate form information  Create a new window with a specified size and screen position  Image Rollovers  Status Messages  Display Current Date  Calculations 5
  • 6. Copyright © Terry Felke-Morris CODING JAVASCRIPT  JavaScript statements can be coded on a web page using two different techniques:  Place JavaScript code between <script> tags  Place JavaScript code as part of an event attached to an HTML element 6
  • 7. Copyright © Terry Felke-Morris JAVASCRIPT: USING THE SCRIPT ELEMENT The script element ◦ A container tag ◦ May be placed in either the head or the body section of a web page <script type="text/javascript"> <!- - alert("Welcome to Our Site"); // - -> </script> 7
  • 8. Copyright © Terry Felke-Morris CHECKPOINT 1. Describe at least three popular uses for JavaScript. 2. How many JavaScript code blocks can be embedded in an HTML document? 3. Describe a method that can be used to find an error in a JavaScript code block. 8
  • 9. Copyright © Terry Felke-Morris DOCUMENT OBJECT MODEL (DOM) A portion of the DOM is shown at the left. Defines every object and element on a web page Hierarchical structure Accesses page elements and apply styles to page elements 9
  • 10. Copyright © Terry Felke-Morris OBJECT  An object is a thing or entity.  Browser window  Submit button  Web page document 10
  • 11. Copyright © Terry Felke-Morris PROPERTY  A property is a characteristic or attribute of an object.  The background color of a web page document document.bgcolor  The date the web page file was last modified document.lastmodified  The src file of an image object image1.src 11
  • 12. Copyright © Terry Felke-Morris METHOD  A method is an action (a verb)  Writing text to a web page document document.write()  Submitting a form form1.submit() 12
  • 13. Copyright © Terry Felke-Morris JAVASCRIPT AND EVENTS Events: actions taken by the web page visitor ◦ clicking (onclick), ◦ placing the mouse on an element (onmouseover), ◦ removing the mouse from an element (onmouseout), ◦ loading the page (onload), ◦ unloading the page (onunload), etc. 13
  • 14. EVENTS Event Event Handler click onclick load onload mouseover onmouseover mouseout onmouseout submit onsubmit unload onunload 14
  • 15. Copyright © Terry Felke-Morris JAVASCRIPT AND EVENTS  JavaScript can be configured to perform actions when events occur.  The event name is coded as an attribute of an HTML tag  The value of the event attribute contains the JavaScript code Example: Display an alert box when the mouse is placed over a hyperlink. 15 <a href="home.htm" onmouseover="alert('Click to go home')">Home</a>
  • 16. Copyright © Terry Felke-Morris JAVASCRIPT DEBUGGING(1) Check the syntax of the statements ◦ Pay very close attention to upper and lower case letters, spaces, and quotations Verify that you have saved the page with your most recent changes Verify that you are testing the most recent version of the page (refresh or reload the page) If you get an error message, use the error messages that are displayed by the browser ◦ In Firefox: Select Tools > Error Console 16
  • 17. Copyright © Terry Felke-Morris JAVASCRIPT DEBUGGING(2)  Use the Firefox browser:  Select Tools > Error Console from the Menu  The Error Console will indicate an issue and the line number  This may not be exactly where the problem is  Sometimes the error is a one or two lines above the indicated line number. 17
  • 18. Copyright © Terry Felke-Morris CHECKPOINT 1. With respect to objects, describe the difference between a property and a method. Feel free to use words like “thing,” “action,”“description,”“attribute,” and so forth. 2. What is the difference between an event and an event handler? 3. Where are event handlers placed in the HTML document? 18
  • 19. Copyright © Terry Felke-Morris VARIABLE  A variable is a placeholder for information.  The variable is stored in the computer’s memory (RAM). var userName; userName = "Karen"; document.write(userName); 19
  • 20. Copyright © Terry Felke-Morris PROMPTS  prompt() method  Displays a message and accepts a value from the user myName = prompt(“prompt message”);  The value typed by the user is stored in the variable myName 20
  • 21. ARITHMETIC OPERATORS Operat or Description Example Value of Quantity = assign quantity = 10 10 + addition quantity = 10 + 6 16 - subtraction quantity = 10 - 6 4 * multiplication quantity = 10 * 2 20 / division quantity = 10 / 2 5 21
  • 22. COMPARISON OPERATORS Operator Description Example Sample values of quantity that would result in true = = Double equals sign (equivalent) “is exactly equal to” quantity = = 10 10 > Greater than quantity > 10 11, 12 (but not 10) > = Greater than or equal to quantity > = 10 10, 11, 12 < Less than quantity < 10 8, 9 (but not 10) < = Less than or equal to quantity < = 10 8, 9, 10 ! = Not equal to quantity ! = 10 8, 9, 11 (but not 10) 22
  • 23. Copyright © Terry Felke-Morris DECISION MAKING if (condition) { … commands to execute if condition is true } else { … commands to execute if condition is false } 23
  • 24. Copyright © Terry Felke-Morris FUNCTION  A function is a block of one or more JavaScript statements with a specific purpose, which can be run when needed. function function_name() { ... JavaScript statements … } 24
  • 25. Copyright © Terry Felke-Morris USING FUNCTIONS function showAlert() { alert("Please click OK to continue."); } 25 Calling the Function showAlert(); Defining the Function
  • 26. Copyright © Terry Felke-Morris CHECKPOINT 1. Describe a method that can be used to gather a piece of data such as the user’s age. 2. Write the JavaScript code to display an alert message for users who are under 18 years old and a different alert message for users who are 18 years or older. 3. What is a function definition? 26
  • 27. Copyright © Terry Felke-Morris FORMVALIDATION  It is common to use JavaScript to validate form information before submitting it to the web server.  Is the name entered?  Is the e-mail address of correct format?  Is the phone number in the correct format?  See Hands-on Practice 14.8 27
  • 28. Copyright © Terry Felke-Morris VALIDATING FORM FIELDS  Use the "" or null to check to determine if a form field has information if (document.forms[0].userName.value == "" ) { alert("Name field cannot be empty."); return false; } // end if 28
  • 29. Copyright © Terry Felke-Morris JAVASCRIPT & ACCESSIBILITY  Don’t expect JavaScript to always function for every visitor  Some may have JavaScript disabled  Some may be physically unable to click a mouse  Provide a way for your site to be used if JavaScript is not functioning  Plain text links  E-mail contact info 29
  • 30. Copyright © Terry Felke-Morris CHECKPOINT 1. What is meant by the term “form data validation”? 2. Give three examples of form data that may require validation. 3. Should you always expect your JavaScript to “work” – why or why not? 30
  • 31. Copyright © Terry Felke-Morris SUMMARY This chapter introduced the use of JavaScript on web pages. Topics included:  Common uses of JavaScript in web pages.  The purpose of the Document Object Model  The script element  The alert() method  Use variables, operators and the if control structure.  Configure functions  Using JavaScript to validate a form 31