SlideShare a Scribd company logo
HTML/JavaScript/CSS
History
 What is the relationship between:
 SGML
 HTML
 XHTML
 CSS
 JavaScript
History
 Markup
 Annotations instructing how the document
should appear in print
 Word processors use different markup
schemes
 SGML
IBM - Standard Generalized Markup Language
Markup instructions stored with ASCII file
 Any computer could render document
 Lilly Example
History
 HTML
 Tim Berners-Lee created HTML – subset of
SGML
 Not platform or application specific
 Only server software needed to publish file s
on the net

 Structure versus content
 Browser parses HTML file into a tree

Recommended for you

Web front end development introduction to html css and javascript
Web front end development introduction to html css and javascriptWeb front end development introduction to html css and javascript
Web front end development introduction to html css and javascript

This document provides an introduction to HTML, CSS, and JavaScript for building websites. It discusses how websites work by connecting clients and servers, and compares making a website to writing a book by organizing content into pages. The document then covers the basic purposes and syntax of HTML for creating page content, CSS for styling, and JavaScript for interactivity. It provides many code examples and explains common elements, properties, and methods in each language to demonstrate basic front-end web development concepts and tools.

htmlweb developmentcss
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5

This is a brief introduction about HTML5. You will learn that what is new in HTML5. I will tell what and when changes happened in HTML which Hyper Text markup language. Html is a language which is used to create web pages that we have seen on the internet. For website development and web hosting visit https://tekfold.com

web developmentweb designhtml5
Javascript
JavascriptJavascript
Javascript

JavaScript is a client-side scripting language that can be inserted into HTML pages to make them interactive. It allows dynamic validation of forms, changing HTML element properties like visibility, and reacting to user events like clicks or form submissions. The Document Object Model (DOM) represents an HTML or XML document as a tree structure, allowing JavaScript to programmatically access and modify the content, structure, and styling of the document. Common built-in JavaScript objects include String, Date, Array, Math, and Boolean, which provide properties and methods for manipulating text, dates, lists of values, numbers, and true/false values.

History
 Sample HTML File
 <FONT SIZE=14 FACE=Swing>
 <B>Bryan Moore</B><BR>
 </FONT>
 <FONT SIZE=12 FACE=Textile>
 1234 Sunset Ave. <BR>
 Walla Walla, WA 12345 <BR>
 (123)123.4567<BR>
 </FONT>
Web Applications and Real World Design - Knuckles
History
Browser parse tree

Web Applications and Real World Design - Knuckles
History
 Problems with extracting data
 Need to write a computer program to extract
the names and addresses by selecting text
strings following font tags

 Content and structure of document become
intertwined
 Not the intention of SGML and original HTML
 Cascading Style Sheets
 Attempt to separate content and style
History
 CSS
 Can alter the look of entire file with a simple
coding change
 Can keep styles in an external file
 Increases the knowledge needed to code
pages
Initial rationale of HTML was to appeal to the
masses

Recommended for you

Web Designing Presentation
Web Designing PresentationWeb Designing Presentation
Web Designing Presentation

The document discusses the key aspects of web design. It identifies the main languages used for frontend web design as HTML, CSS, and JavaScript. Popular backend languages are identified as PHP, Ruby, Python, Node.js, and Java. The document also defines responsive web design as using HTML and CSS to automatically resize a website to look good on all devices like desktops, tablets, and phones. It provides an overview of common elements considered in web design like content, logo, typography, layout, colors, navigation, and being cross-browser responsive.

#webdesign#introduction of web design#web designing presentation
HTML CSS & Javascript
HTML CSS & JavascriptHTML CSS & Javascript
HTML CSS & Javascript

- HTML, CSS, and JavaScript are becoming the new standard for building applications and interactive experiences on the web. - Best practices include using semantic HTML, clean CSS with a focus on maintainability, and JavaScript performance optimizations. - Key techniques discussed are image sprites, progressive enhancement, and jQuery selector chaining to reduce DOM lookups.

htmlficss
javaScript.ppt
javaScript.pptjavaScript.ppt
javaScript.ppt

This document provides an overview of JavaScript and the DOM (Document Object Model) for a web programming course. It introduces JavaScript as a scripting language used to add interactivity to HTML pages. It describes what JavaScript can do, such as dynamically updating text and reacting to events. It also covers JavaScript syntax, variables, operators, functions, and objects. A significant portion of the document is devoted to explaining the DOM and how it allows JavaScript to access and modify HTML elements and structure programmatically.

History
Parse tree using CSS

Still need to reference
Information based on
“second string after BR”
Information is not
meaningful

Web Applications and Real World Design - Knuckles
History
 Extensible Markup Language XML
 Extensible- can create own tags
 Complete separation of content and style

Web Applications and Real World Design - Knuckles
History
 Releases
 HTML 4.0 1997
 XML 1.0 1998

 XML and HTML need to better cooperate
 XHTML 1.0 2000

 XHTML
 Contains elements and attributes of HTML
 Elements must have closing tags
 Lowercase
 Attributes must have values
 Attributes in single or double quotes
 http://www.w3schools.com/xhtml/default.asp
HTML Forms and JavaScript
 Client Server Model
 Client Side Processing
 JavaScript downloaded from web page and processed by
the client – typically form checking
 JavaScript can interact directly with form data

 Server Side processing
 Information from a form sent to server for processing
 PHP Perl C++
 Server can interact directly with the form data

Recommended for you

ppt of web designing and development
ppt of web designing and developmentppt of web designing and development
ppt of web designing and development

Web designers create the visual design and layout of websites, while web developers write code to make websites functional. Web developers use programming languages like HTML, CSS, JavaScript, and PHP to add complex features and functionality to websites. Studying these languages and gaining experience through live projects allows individuals to pursue careers as web designers or developers where there is high demand for their skills.

ppt of web designing and developmentbatra computer centre
CSS ppt
CSS pptCSS ppt
CSS ppt

Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation of HTML and XML documents. CSS separates document content from document presentation, enabling control over elements like layout, colors, and fonts. This separation improves accessibility, flexibility, and maintenance of web pages. CSS can format pages for different rendering methods like on-screen, in print, and for speech-based browsers.

Java script
Java scriptJava script
Java script

JavaScript is a scripting language that can be inserted into HTML pages and used to program the behavior of web pages. It allows web pages to be dynamic and interactive. JavaScript code is placed between <script> and </script> tags and can manipulate HTML elements and write to the document. Variables, functions, conditional statements, and operators allow JavaScript code to run conditionally based on events or user input. JavaScript is case sensitive, uses semicolons, and has both local and global variables. Common data types include numbers, strings, arrays, and objects.

HTML Forms and JavaScript
 JavaScript
 HTML files are text files
 JavaScript is interpreted not compiled
 Object oriented
HTML forms are objects and can be manipulated
via JavaScript
Dynamic HTML – merger of JavaScript and
HTML

 Different implementations of DHTML by
software companies
What is JavaScript


Scripting language (object-oriented)
 Lightweight programming language developed by Netscape
 Interpreted, not compiled



Designed to be embedded in browsers









Ideal for adding interactivity to HTML pages
Detect browser versions
Work with info from user via HTML forms
Create cookies
Validate form data
Read and write HTML elements

Supported by all major browsers
 Internet Explorer has JScript (started in IE3)
 http://www.faqts.com/knowledge_base/view.phtml/aid/1380



It’s free, no license required
What is JavaScript
 Syntax is similar to Java, but it’s not Java per se
 Usually JavaScript code is embedded within HTML
code using the script tag:
 Can have more than one pair of script tags in a page
 Semicolons: C++ and JAVA require them but in
JavaScript it’s optional
What is JavaScript
 HelloWorld example program…


<html>











<head><title>JavaScript HelloWorld!
</title></head>
<body>
<script language="JavaScript">
document.write('Javascript says "Hello
World!"')
</script>
</body>

</html>

 Let’s open it in the browser

Recommended for you

JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...

( ** Full Stack Web Development Training: https://www.edureka.co/masters-program/full-stack-developer-training ** ) This Edureka tutorial on JavaScript explains all the fundamentals of JavaScript with examples. It also explains various features and applications of JavaScript. Following are the topics included in this tutorial: 1. What Is JavaScript? 2. Why Use JavaScript 3. JavaScript Fundamentals - Data Types - Variables - Constants - Loops - Conditional Statements - Functions

javascriptjavascript tutorialjavascript tutorial for beginners
Static and Dynamic webpage
Static and Dynamic webpageStatic and Dynamic webpage
Static and Dynamic webpage

The document discusses the basics of HTML, which is used to design webpages through tags and attributes, and defines dynamic HTML (DHTML) as combining HTML, JavaScript, CSS, and scripting to make webpages interactive and able to change based on user inputs. Static webpages only use HTML and CSS and cannot dynamically change, while dynamic pages use client-side or server-side scripting to alter the content displayed to users.

htmlserver-side scriptingdhtml
Web Development Presentation
Web Development PresentationWeb Development Presentation
Web Development Presentation

The document provides an overview of web development. It discusses how the web was created in 1989 by Tim Berners-Lee and the initial technologies of HTTP, HTML, and URLs. It then explains how a basic web application works with a browser connecting to a web server to request and receive HTML files and other resources. The document also summarizes key concepts in web development including front-end versus back-end code, common programming languages and frameworks, database usage, and standards that allow interoperability across systems.

codesjsonweb development
What is JavaScript
 Javascript can be located in the head, body
or external file
 Head section
Ensures script is loaded before trigger event

 Body section
Script executes when body loads

 External
Allows scripts to run on several pages

 Examples:
http://www.w3schools.com/js/js_whereto.asp
What is JavaScript
 JavaScript statements in head write to the
beginning of the body section but don’t violate
HTML code already there.
 JavaScript statements in body write based on
their location
 JavaScript interpreted first then HTML
interpreted second
 Document.write writes to the HTML document
not the web page
What is JavaScript












<html>
<head>
<script language=“JavaScript”>
document.write (“<b> This is first </b>);
</script>
</head>
<body>
Now where does this print on the web page???? <br />
<script language=“JavaScript”>
document.write ( “This might be last?”)
</script>




</body>
</html>



Lets See what the answer is!
What is JavaScript
 Now, let JavaScript generate HTML for us…
 <html>

<head><title>JavaScript HelloWorld!</title></head>

<body>

<script laguage="JavaScript">


document.write("<h2>Javascript-Generated output:</h2>
<p>This paragraph generated by JavaScript</p>
 <p>It can even insert an image</p>
 <img src='../assigns/RayWeb/images/cathedral.jpg' />")


</script>

</body>
 </html>

 Let’s open it in the browser

Recommended for you

Css3
Css3Css3
Css3

CSS3 is an update to the CSS2.1 specification that introduces many new features and modules. Some key CSS3 modules include selectors, backgrounds and borders, text effects, transformations, transitions, multiple columns, and user interface. CSS3 allows for rounded borders using border-radius, box shadows using box-shadow, and image borders using border-image. Other CSS3 properties include text-shadow, word-wrap, transforms like rotate and scale, transitions for animated effects, multiple columns layout, and user interface features like resizing and outlines. Support for CSS3 varies across browsers.

css3
WEB I - 01 - Introduction to Web Development
WEB I - 01 - Introduction to Web DevelopmentWEB I - 01 - Introduction to Web Development
WEB I - 01 - Introduction to Web Development

Introduction to XHTML Forms for Web Development 1 Course suitable for degree following CIT/CIS/CS ACM model curriculum.

teachhtmlweb
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive Design

This document discusses responsive web design using CSS3 media queries. It begins with an introduction to media queries and their syntax for modifying CSS based on screen width. It then covers examples of adapting layouts, images, and other design elements for different screen sizes. Finally, it addresses techniques for supporting older browsers that do not support media queries, such as using conditional comments or JavaScript libraries.

web designmedia queriesresponsive web design
Identifier Etiquette
 Identifier– The name of a variable (or function)
 Starts with a letter, can contains digits & underscores
 Case Sensitive!!
 Should be meaningful to someone reading your code

 Good: accountBalance, amountDue
 Bad:

bal, due,

 Just plain wrong: 2bOrNotToBe, +var, total-value
Variables
 Must declare variables before they’re used in the
program
 Declare at the top of the program & terminate each
statement with ‘;’
 Intialize variables when appropriate
 Local variables (declared within a function) destroyed
after function exit.
 Can only be accessed within the function

 Example – Note Assignments
 var candyBarPrice = 2.50;
 var taxRate = .075;
 var candyBarsPurchased;
Assignment Operator
 Assignment ‘looks like’ equal sign but does NOT
behave like it
 subTotal = subTotal + 1.50
 subTotal ‘is assigned the value’ that is currently in
subTotal plus the value of 1.50
Expressions
 An expression is a statement that describes a
computation
 Usually look like algebra formulas
 total = subTotal * taxRate

 Operators (+, -, *, /, etc.) have different levels
of precedence, similar to algebra
 Don’t rely on it! For clarity, use parentheses

 w3Schools operator reference page

Recommended for you

Java script
Java scriptJava script
Java script

JavaScript was designed to add interactivity to HTML pages. It is a scripting language that is usually embedded directly into HTML pages and allows for dynamic text, event handling, reading/writing HTML elements, and validating form data. JavaScript supports both client-side and server-side scripting and was originally developed by Netscape under the name LiveScript before being renamed. It provides programming capabilities to HTML authors and allows for dynamic content, user interaction, and validation without server requests.

An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script

HTML is a markup language used to define the structure and layout of web pages. It uses tags like <h1> and <p> to mark headings and paragraphs. CSS is used to style and lay out HTML elements, using selectors, declarations, and properties to change things like colors and positioning. JavaScript can be added to HTML pages with <script> tags and is used to add interactive elements and dynamic behavior by manipulating HTML and responding to user input. It has data types like strings and numbers and control structures like if/else statements.

html learninghtmlcss learning
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js

HTML is a markup language used to define the structure and layout of web pages. CSS is used to style and lay out HTML elements, and JavaScript can be used to program behaviors and interactions in web pages. jQuery is a JavaScript library that simplifies HTML document traversal and manipulation, as well as event handling, animations, and Ajax interactions for rapid web development.

Conditional Statements--if
if (some boolean expression is true){
execute the statements within
the curly braces, otherwise skip to the
first statement after the closing brace
}
Resume execution here in either case
Conditional Statements– if/else
if (some boolean expression is true){
execute these statements, otherwise
skip to ‘else’ clause
}
else {
execute these statements if boolean
expression is false
}
Resume execution here in either case
Conditional Test Program
 Diagnostic messages indicate flow of control
1.
2.
3.
4.

var variable1 = 1; var variable2 = 2;

1.
2.

if(variable1 > variable2){

if(variable1 >= 0){
document.write(“<p> 1 is greater than 0

</p>");
5.
}
6.
document.write(“<p>Resuming execution after
'if'
7.
statement</p>");
8.

3.
4.
5.
6.
•

document.write(“<p>1 is greater than
2</p>");
}
else {
document.write(“<p>2 is greater than
1</p>");
}
document.write("Resuming execution after
Strings
 Strings are sequences of keyboard characters
enclosed in quotes


“Hello World” or ‘Hello World’

 Variables can hold strings
 var greeting = “Hello World”

 String can be empty, i.e., contain no characters
 var myAnswer = “”

 Use ‘’ (escape symbol) to ‘type’ prohibited characters
 b for backspace, n for newline, t for tab, ” for double
quote

Recommended for you

An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScriptAn Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript

This document provides an introduction to web development technologies for SEOs, covering HTML, CSS, JavaScript, and how they relate to each other and web architecture. It begins with an overview of the main components of a website, including the CMS, front-end code, back-end code, database, web server, domain name, DNS, and physical server. It then covers HTML basics like tags and document structure. It discusses CSS and how it is used to style pages. Finally, it provides a brief introduction to JavaScript and how it adds dynamic functionality to websites. The document is intended to give SEOs a basic technical understanding of web development.

htmlcssjavascript
HTML CSS JavaScript jQuery Training
HTML CSS JavaScript jQuery TrainingHTML CSS JavaScript jQuery Training
HTML CSS JavaScript jQuery Training

The document provides a 6 day training agenda covering HTML, CSS, JavaScript, and jQuery. Day 1 covers HTML basics, CSS basics and layouts. Day 2 covers HTML forms, CSS styling, and responsive design. Days 3-5 cover JavaScript programming, events, AJAX, and jQuery. Day 6 covers more advanced jQuery topics.

htmlcssajax
An Intro to HTML5 and CSS3
An Intro to HTML5 and CSS3An Intro to HTML5 and CSS3
An Intro to HTML5 and CSS3

HTML5 and CSS3 provide modern web technologies that can enhance websites. Modernizr is a JavaScript library that detects what HTML5 and CSS3 capabilities browsers support, allowing for enhanced functionality where available. The document provides references to learn more about HTML5, CSS3, and tools like Modernizr.

html5css3
JavaScript Functions – Basic
Principles
 Abstraction
 Experience has taught us that much code is
duplicated throughout program
 Functions let us write the functionality once,
then reuse it
JavaScript Functions – Basic
Principles
 Encapsulation
 Functions encapsulate a specific capability or feature
 Function name allows us to access a function in our
program

 Parameterization
 We can customize the function’s result by passing in
different values each time we use it

 Must use functions to write serious software!
JavaScript Functions – Basic
Principles
 Reasons to use functions
 Ease of communication
 Problem simplification
 Easier construction
 Code readability
 Reusability
 Maintainability

 In JS, functions are the primary encapsulation
mechanism
JavaScript Functions – Syntax
 JS function syntax
function myFunctionName (list of parameters) {
….JS code here…
}

Recommended for you

Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design

The document discusses responsive web design (RWD), which involves building websites and applications that automatically adjust layouts based on screen size and orientation. RWD allows a single website to be accessed from any device without needing separate mobile sites. It provides benefits like improved usability, lower development costs, and future-proofing sites for new devices. Key aspects of RWD include flexible grids, fluid images, media queries, and focus on content over specific device designs.

responsive web designbangalorebarcamp
Crowdsourcing Presentation for Creative Company Conference
Crowdsourcing Presentation for Creative Company ConferenceCrowdsourcing Presentation for Creative Company Conference
Crowdsourcing Presentation for Creative Company Conference

Trada CEO Niel Robertson's presentation on Crowdsourcing for the Creative Company Conference Check out Trada Reviews here: http://www.trada.com/trada-reviews/

crowdsourcingcreative company conferenceniel robertson
JavaScript Functions -- Issues
 Key issues about using functions
 Naming functions
 Passing in parameters
 Using local variables within functions
 How to call (i.e., invoke) functions
 How to handle a function’s return value
 Where to put JS functions in your webpage
JavaScript Functions – Naming
 Function names
 Name describes what function does
 Name is an identifier, so follow JS identifier syntax
rules & course coding standards

 Example,
findMaxValue(‘put some parameters here’)
JavaScript Functions -- Parameters
 Passing parameters to the function
 Parameters provide functions with input
 Implicitly declared variables that can be accessed by
code within function body
 You provide actual input values when you call the
function
 Parameters are named variables separated by
commas

 Example,
function findMaxValue(num1, num2, num3)
JavaScript Functions – Where to
put?
 Put functions within <script>….</script> tags within
the <head> section of the web page
<head>
<script language=“JavaScript”>
declare functions here….
</script>
</head>

Recommended for you

Animation powerpoint
Animation powerpointAnimation powerpoint
Animation powerpoint

Stop motion animation is achieved by recording individual still frames of motion and playing them back sequentially to create the illusion of continuous movement. Each frame is a slightly altered version of the previous frame with objects moved in small increments. This labor intensive process can involve manipulating physical objects, cutouts, or live actors frame-by-frame to simulate movement. Different stop motion techniques produce varied effects and involve altering material positions gradually over many frames to depict animation.

stop motionmediaanimation
my animation presentation (R&D module for university)
my animation presentation (R&D module for university)my animation presentation (R&D module for university)
my animation presentation (R&D module for university)

Presentation for my R&D module for university. The development of my project including how I created moodboards, storyboards and an animatic

Turing Church Online Workshop 2
Turing Church Online Workshop 2Turing Church Online Workshop 2
Turing Church Online Workshop 2

The document discusses several ideas for how future technologies may enable resurrection of the dead, including mind uploading, time scanning/quantum archaeology, simulations, and soft uploading using extensive personal data archives. Key ideas are that sufficiently advanced technologies may allow copying personalities from the past to new substrates, reconstructing the past through quantum effects, creating simulated worlds, and resurrecting aspects of people through archived life information. The document speculates that these could offer literal immortality and fulfill religious desires around an afterlife.

cosmismtranshumanismturingchurch
JavaScript Functions – Local
Variables
 If needed, you can declare local variables within a
function
 local variable is visible only within the function body
after it’s declared
 Commonly used to store results of an intermediate
calculation
JavaScript Functions – Local
Variables
function findMaxValue(num1, num2,num3) {
var tempMax; //local var
if (num1 >= num2) {
tempMax = num1;
}
else {
tempMax = num2;
}
if(num3 >= tempMax) {
tempMax = num3;
}
return tempMax;
} //end function
JavaScript Functions -- Calling
 To call a function from your program, add a
statement that contains the function name with
values for the parameters the function requires
 Example…somewhere in the <body>….,
var x = 1, y = 4, z = 2;
findMaxValue(x, y, z);

 What value does the function return?
 What happens with the result?
JavaScript Functions -- Return
 Return keyword tells function to return some value
and exit immediately
 Function can have multiple return statements but only
1 can be executed in any given function call
 Normally used to return the final result of a
calculation to the calling program
 For an example, see findMaxValue function

Recommended for you

Presentation for Erasmusplus project LTSDU on PISA 2012 results in Italy
Presentation for Erasmusplus project LTSDU on PISA 2012 results in ItalyPresentation for Erasmusplus project LTSDU on PISA 2012 results in Italy
Presentation for Erasmusplus project LTSDU on PISA 2012 results in Italy

Presentation on Italian educational system according to the PISA results 2012 and 2015. The reasons for the failures and the strongpoints of our system.

ocseschool assessmentschool
Taller heramientas multimedias
Taller heramientas multimediasTaller heramientas multimedias
Taller heramientas multimedias

El documento presenta ejemplos de herramientas multimedia como sonidos e imágenes animadas (GIF) sobre el tema de las palancas, incluyendo un GIF creado con Active GIF, para apoyar la enseñanza de este tema. Se invita al lector a reproducir un sonido y ver los ejemplos de GIF animados de Internet sobre palancas.

Power Point Presentation
Power Point PresentationPower Point Presentation
Power Point Presentation

The document discusses the differences between vector and bitmap images, including that vector images use mathematical formulas while bitmaps use pixels, and covers common file formats like JPEG, GIF and PNG. It also explains concepts such as lossless compression, embedded versus linked graphics, and resources for images like Flickr. The document advises against using BMP formats for web content due to browser limitations.

JavaScript Functions -- Return
 Good Example
 Uses var maxNumber in calling program
 Function’s return value is assigned to maxNumber
 Display of maxNumber has correct value for inputs

 Code snippet
 var x = 1, y = 4, z = 2;
var maxNumber = findMaxNumber(x, y, z);
document.write(“The maximum is: “ + maxNumber);
JavaScript Functions – Parameter
Sequence


1.
2.
3.
4.
5.
6.
7.

1.
2.

When calling functions, must enter parameters in same order
as specified in function argument list.

function calculateDensity(height, width, depth, mass){
var volume = height * width * depth;
var density = mass / volume;
return density;
}
……………………………………………….
var hth = 2, wth = 3, dth = 4, mass = 10;
var result = calculateDensity(2, 10, 3, 4);
//returns .07 but correct answer is .42!!!
JavaScript Functions – Global
Variables
 Global variables are those declared outside of
functions
 Global variables are ‘visible’ from anywhere in the
program, including inside functions
var globalHello = “Hello!”;
function writeHello() {
document.write(globalHello);
}
// outputs “Hello!”
Example program
JavaScript Functions – Testing
 Test each function thoroughly before proceeding with
next programming task
 Using multiple sets of inputs, be sure to test all
possible outcomes
 For each test, be sure calling program is properly
handling return values

Recommended for you

Presentation - Animation B2B
Presentation - Animation B2BPresentation - Animation B2B
Presentation - Animation B2B

Animation B2B is an international animation studio that specializes in creating explainer videos between 30-90 seconds to clearly explain products and help customers make faster purchasing decisions. They have created videos for clients such as Znany Lekarz OleOle, Credible Red Bin, and Powerade Starcraft WCS. Potential clients can contact the sales manager Patrick Pawlowski for any questions.

advertising agencyinfographiclead generation
Animation presentation
Animation presentationAnimation presentation
Animation presentation

Animation is the process of creating the illusion of motion by displaying a sequence of images that are slightly different from one another. The main types of animation are 2D animation, 3D animation, motion graphics, stop motion, and traditional animation. 2D animation involves hand-drawn or digitally created images, while 3D animation uses computer-generated 3D models. Motion graphics focuses on moving graphic elements or text, and stop motion animates real-world objects or puppets by moving them incrementally between photographs. Traditional animation historically involved drawing each frame by hand on transparent sheets called cels. The history of animation includes early inventions like the zoetrope and flip books in the 1800s and the first animated films in

Presentation logo contest for ltsdu
Presentation logo contest for ltsduPresentation logo contest for ltsdu
Presentation logo contest for ltsdu

This document summarizes a logo competition held among students from five schools participating in an Erasmus+ project called "Let The Science Discover Us". Students from Istituto Tecnico Economico F. Severi di S. Giovanni Valdarno school in Italy prepared several draft logos by hand and computer. Five logos were preselected, including one from Turkey depicting an atom. Three finalist logos were voted on by teachers from the partner schools on Facebook—the logo with the most likes would win. Two Italian logos received the same number of likes, so there were two winners. The winning students received a small prize of telephone credit.

erasmus+ ltsdu logo competition
JavaScript Functions – Debugging
 Use diagnostic output statements to trace program
execution
 Good places for diagnostic outputs
 Just before entering function
 Immediately upon entering function
 Before/In/After complex logic or computation
 Just before function return statement
 Immediately after function returns to calling program
JavaScript Functions
 Built-In Functions
 Prompt
 Alert
 Confirm

 http://www.w3schools.com/js/js_popup.asp
JavaScript and HTML Forms
 JavaScript Objects
 Var truck = new Object();
 Expression on right is a constructor
 Properties
truck.color=“white”
document.write(color);

 Primitives
 In JavaScript variable primitive types are
number, string and Boolean
JavaScript and HTML Forms
 Object Model for the Browser Window
 Compound object structure is created when a
web page loads into a browser
Hierarchy

 Window is an object, the HTML document is
an object and its elements are objects
 These objects have primitives associated with
them

Recommended for you

Intro to HTML5
Intro to HTML5Intro to HTML5
Intro to HTML5

This document provides a short introduction to HTML5, including: - HTML5 is the 5th version of the HTML standard by the W3C and is still under development but supported by many browsers. - HTML5 introduces new semantic elements, video and audio tags, 2D/3D graphics using <canvas>, and new JavaScript APIs for features like geolocation, offline web apps, and drag and drop. - The document provides examples of using new HTML5 features like video playback, semantic elements, geolocation API, and drawing on a canvas with JavaScript.

html5javascript
Threads in PHP - Presentation
Threads in PHP - Presentation Threads in PHP - Presentation
Threads in PHP - Presentation

Using threads in PHP will change the world. appserver.io is the worlds first real application server for PHP written in PHP supporting multi-threading "out-of-the-box". appserver.io is a next-generation PHP infrastructure consisting of a lightning fast webserver completely written in PHP including additional frequently needed services in one powerful bundle. You can use all of the services or only specifically selected services in your existing application with no additional tweaks. This is just what you need since we have eliminated the need for additional tools or additional services, appserver.io and PHP and you´re done!

appserver.ioapplication servermulti-threading php
Core Php Component Presentation
Core Php Component PresentationCore Php Component Presentation
Core Php Component Presentation

The document discusses various components and techniques for developing extensions for Joomla! 1.5, including using libraries, retrieving data from requests, multilingual support, querying and retrieving data from the database, routing URLs, handling errors, security practices, and redirecting users. It also mentions tools for development like Aptana and resources on the Joomla! API and extension development.

JavaScript and HTML Forms
 window [closed, location]
history [length]
document [bgColor, fgColor, URL,
lastmodified,linkColor, vlinkColor]





images [properties]
links [properties]
frames [properties]
forms [properties]
JavaScript and HTML Forms
 Window object is parent of structure
 window.closed is primitive that is Boolean
 window.location primitive contains string of the URL of
the HTML file
 window.document object is primary focus

 When web page is loaded the HTML elements assign
values to most of these window.document primitives
 Often the word window is excluded as in
document.write but need it if referring to multiple
open windows
 Properties can also be objects
JavaScript and HTML Forms



















<HTML>
<HEAD>
<TITLE>Document Properties</TITLE>
<SCRIPT LANGUAGE=JavaScript><!-document.write(closed);
document.write("<BR>"+ document.bgColor);
document.write("<BR>"+document.fgColor);
document.write("<BR>"+document.lastModified);
//--></SCRIPT>
</HEAD>
<BODY TEXT="#0000FF" BGCOLOR="#FFFFCC">
<P>Blue text on a yellow background.<BR>
<SCRIPT LANGUAGE=JavaScript><!-document.write("<BR>"+ document.bgColor);
document.write("<BR>"+document.fgColor);
//--></SCRIPT>
</BODY>
</HTML>
Interactive Programming on the Internet Knuckles
JavaScript and HTML Forms
 false
#ffffff
#000000
01/10/2001 17:18:30 Blue text on a yellow
background.
#ffffcc
#0000ff

Interactive Programming on the Internet, Knuckles

Recommended for you

PHP in one presentation
PHP in one presentationPHP in one presentation
PHP in one presentation

PHP in on Presentation Slides: Desktop Application. Enterprise Application. Web Application. HTML. PHP. Intro. Environments. IDEs. Syntax. Data types. Variables. Operations. Array. Decision Making. Loop. Function. Closure. OOP. Exceptions. HTML Form. Cookie. Session. Hosting.

phppresentationsummary
CHAPTER 3 JS (1).pptx
CHAPTER 3  JS (1).pptxCHAPTER 3  JS (1).pptx
CHAPTER 3 JS (1).pptx

This document provides an overview of JavaScript including: - JavaScript can be used to add interactivity to web pages by responding to user actions and modifying page content. It runs in the browser rather than on the server. - Common tasks performed by JavaScript include form validation, monitoring user events, updating page elements, and modifying styles. - JavaScript code can be embedded directly in HTML, referenced externally, or added via <script> tags in the <head> or <body> sections. - JavaScript variables are declared with var and can hold numbers, strings, Booleans, arrays, and objects. Statements are composed of values, operators, expressions, and comments to perform tasks.

javascript
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
IT2255 Web Essentials - Unit III Client-Side Processing and ScriptingIT2255 Web Essentials - Unit III Client-Side Processing and Scripting
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting

JavaScript Introduction – Variables and Data Types – Statements – Operators – Literals – Functions – Objects – Arrays – Built-in Objects – Regular Expression, Exceptions, Event handling, Validation – JavaScript Debuggers.

JavaScript and HTML Forms
 Methods
 Behavior associated with an object
 Essentially functions that perform an action
 Some are built in and others user made

 Built-In Methods of the window object
 Confirm
 Alert
 Prompt
JavaScript and HTML Forms
 User Events
 An event occurs when a user makes a change
to a form element
Ex. Click a button, mouseover an image

 Detection of an event done by event handlers
 Event handler is an attribute of the HTML
button
 <form>
<input type=button value=“please click”
onclick=“function name()”>

 </form>
JavaScript and HTML Forms
<HTML>
<HEAD>
<SCRIPT LANGUAGE=JavaScript><!-function changecolor(){
document.bgColor="#ff0000";
}
//--></SCRIPT>
</HEAD>
<BODY>
<P><FORM >
<P><INPUT TYPE=button VALUE="Click Me"
onclick="changecolor()">
 </FORM>
 </BODY>
 </HTML>












Interactive Programming on the Internet ,Knuckles
JavaScript and HTML Forms
 Form Object
 Window.document.form
 A form is a property of the document but is
also an object
 Form elements are properties of a form and
are also objects
 Access to form’s properties is done through
the NAME attribute of the FORM tag
 Access to the properties of the form elements
is done through the NAME attributes of the
particular form element

Recommended for you

JavaScript_III.pptx
JavaScript_III.pptxJavaScript_III.pptx
JavaScript_III.pptx

This document provides an overview of JavaScript, including: - JavaScript is not related to Java and was originally called LiveScript. - JavaScript code is run in web browsers by an interpreter built into the browser, not on servers. - JavaScript can be used to add interactivity to HTML pages by including <script> tags and running code when pages load or in response to user events. - JavaScript functions and variables can be defined and used to manipulate the DOM and handle user interactions.

Iwt note(module 2)
Iwt note(module 2)Iwt note(module 2)
Iwt note(module 2)

This document provides an overview of Module 2 of a course on Internet and Web Technology. It covers topics related to JavaScript, including: - Programming fundamentals of JavaScript like variables, functions, and statements - Different types of operators in JavaScript like arithmetic, comparison, logical, and assignment operators - Defining and calling functions - Using built-in functions like alert(), confirm(), and prompt() - Best practices for writing JavaScript code

Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]

The document provides an overview of VBScript, including how it works when inserted into HTML documents, how to format VBScript code within HTML tags, and where to place VBScript code within an HTML document. It also discusses VBScript variables like declaring, assigning values to, and creating array variables. Finally, it covers VBScript procedures like Sub and Function procedures.

JavaScript and HTML Forms

Interactive Programming on the Internet
,Knuckles
JavaScript and HTML Forms


























<HTML>
<HEAD>
<SCRIPT LANGUAGE=JavaScript><!-function plus(){
var n1;
var n2;
n1=document.addmult.num1.value;
n2=document.addmult.num2.value;
n1=parseFloat(n1);
n2=parseFloat(n2);
document.addmult.result.value=n1+n2;
}
function times(){
var n1;
var n2;
n1=document.addmult.num1.value;
n2=document.addmult.num2.value;
n1=parseFloat(n1);
n2=parseFloat(n2);
document.addmult.result.value=n1*n2;
}

Interactive Programming on the Internet ,Knuckles
















//--></SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFCC">
<P><FORM name=addmult>
<P>Enter a number in each field:
<INPUT TYPE=text NAME=num1 VALUE="" SIZE=5>
<INPUT TYPE=text NAME=num2 VALUE=""
SIZE=5><BR>
<INPUT TYPE=button VALUE="+" onclick="plus()">
<INPUT TYPE=button VALUE="*"
onclick="times()"><BR>
<INPUT TYPE=reset VALUE="Reset Form"><BR>
<TEXTAREA NAME=result ROWS=3 COLS=27
WRAP=virtual></TEXTAREA>
</FORM>
</BODY>
</HTML>
JavaScript and HTML Forms
Form for submitting info for server side processing

Interactive Programming on the Internet
,Knuckles
JavaScript and HTML Forms




























<HTML>
<HEAD>
<SCRIPT LANGUAGE=JavaScript><!-function verify(){
with(document.infoform){
if((fullname.value=="")||(address.value=="")||
(email.value=="")){
alert("You have left one or more fields blank. Please
supply the
necessary information, and resubmit the form.");
}
else {
display.value="The following information has been
added to our
guestbook:r"+fullname.value+"r"+ address.value +"r"
+email.value;
}
}
}
//--></SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFCC">
<P><FORM name=infoform>
<P><TABLE BORDER=0>
<TR>
<TD WIDTH=83>
<P>Name:
</TD>
<TD>
<P><INPUT TYPE=text NAME=fullname VALUE=""
SIZE=32>
</TD>
</TR>




<TR>





<TD WIDTH=83>
<P>Address:
</TD>
<TD>
<P><INPUT TYPE=text NAME=address VALUE=""
SIZE=32>
</TD>
</TR>
<TR>
<TD WIDTH=83>
<P>E-mail:
</TD>
<TD>
<P><INPUT TYPE=text NAME=email VALUE=""
SIZE=32>
</TD>
</TR>
<TR>
<TD WIDTH=83>
<P><INPUT TYPE=button VALUE="Submit"
onclick="verify()">
</TD>
<TD>
<P><INPUT TYPE=reset VALUE="Clear Your
Information">
</TD>
</TR>
<TR>
<TD COLSPAN=2>
<P><TEXTAREA NAME=display ROWS=5 COLS=41
WRAP=virtual></TEXTAREA>
</TD>
</TR>
</TABLE>





</FORM>
</BODY>
</HTML>



























Recommended for you

JavaScript with Syntax & Implementation
JavaScript with Syntax & ImplementationJavaScript with Syntax & Implementation
JavaScript with Syntax & Implementation

JavaScript with Syntax & Implementation JavaScript : Features Syntax JavaScript :Objects JavaScript :Properties JavaScript :Methods JavaScript :Events JavaScript :Functions JavaScript :Values Variables JavaScript :Expressions JavaScript :Operators output of each components

javascriptwebweb2.0
Basic JavaScript Tutorial
Basic JavaScript TutorialBasic JavaScript Tutorial
Basic JavaScript Tutorial

This article is the first part of a series of articles on using JavaScript tools. Today, JavaScript is a very powerful language that can be used to build web apps, mobile apps, and even some pc games — perhaps a bit faster than you would build them otherwise. New libraries have emerged in the web industry to address the challenges of JavaScript — libraries such as JQuery, Prototype and many others have been released. Today, a popular question asked by many is — should i learn the libraries such as jQuery or learn basic JavaScript. The truth is that the libraries help you to create faster, responsive JavaScript, but there are still times when your basic knowlege of JavaScript will be called into question. It is for this reason that I have created this eBook, to assist newbies learn JavaScript.

ecmascriptbeginnerjavascript
Wt unit 5
Wt unit 5Wt unit 5
Wt unit 5

This document provides an introduction to JavaScript and covers topics such as: - JavaScript allows for interactivity on web pages by manipulating the browser and reacting to user actions. - JavaScript code is embedded within HTML pages and executed on the client-side by the browser. - Common JavaScript concepts covered include variables, functions, scope, events, and form validation. - JavaScript can be used to validate user input, perform calculations, and modify the DOM in response to events.

More Related Content

What's hot

HTML5 & CSS3
HTML5 & CSS3 HTML5 & CSS3
HTML5 & CSS3
Ian Lintner
 
Presentation on HTML
Presentation on HTMLPresentation on HTML
Presentation on HTML
satvirsandhu9
 
Js ppt
Js pptJs ppt
Js ppt
Rakhi Thota
 
Web front end development introduction to html css and javascript
Web front end development introduction to html css and javascriptWeb front end development introduction to html css and javascript
Web front end development introduction to html css and javascript
Marc Huang
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
IT Geeks
 
Javascript
JavascriptJavascript
Javascript
mussawir20
 
Web Designing Presentation
Web Designing PresentationWeb Designing Presentation
Web Designing Presentation
RahulSuri30
 
HTML CSS & Javascript
HTML CSS & JavascriptHTML CSS & Javascript
HTML CSS & Javascript
David Lindkvist
 
javaScript.ppt
javaScript.pptjavaScript.ppt
javaScript.ppt
sentayehu
 
ppt of web designing and development
ppt of web designing and developmentppt of web designing and development
ppt of web designing and development
47ishu
 
CSS ppt
CSS pptCSS ppt
Java script
Java scriptJava script
Java script
Shyam Khant
 
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
Edureka!
 
Static and Dynamic webpage
Static and Dynamic webpageStatic and Dynamic webpage
Static and Dynamic webpage
Aishwarya Pallai
 
Web Development Presentation
Web Development PresentationWeb Development Presentation
Web Development Presentation
TurnToTech
 
Css3
Css3Css3
WEB I - 01 - Introduction to Web Development
WEB I - 01 - Introduction to Web DevelopmentWEB I - 01 - Introduction to Web Development
WEB I - 01 - Introduction to Web Development
Randy Connolly
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive Design
Zoe Gillenwater
 
Java script
Java scriptJava script
Java script
Abhishek Kesharwani
 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
Fahim Abdullah
 

What's hot (20)

HTML5 & CSS3
HTML5 & CSS3 HTML5 & CSS3
HTML5 & CSS3
 
Presentation on HTML
Presentation on HTMLPresentation on HTML
Presentation on HTML
 
Js ppt
Js pptJs ppt
Js ppt
 
Web front end development introduction to html css and javascript
Web front end development introduction to html css and javascriptWeb front end development introduction to html css and javascript
Web front end development introduction to html css and javascript
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
Javascript
JavascriptJavascript
Javascript
 
Web Designing Presentation
Web Designing PresentationWeb Designing Presentation
Web Designing Presentation
 
HTML CSS & Javascript
HTML CSS & JavascriptHTML CSS & Javascript
HTML CSS & Javascript
 
javaScript.ppt
javaScript.pptjavaScript.ppt
javaScript.ppt
 
ppt of web designing and development
ppt of web designing and developmentppt of web designing and development
ppt of web designing and development
 
CSS ppt
CSS pptCSS ppt
CSS ppt
 
Java script
Java scriptJava script
Java script
 
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
JavaScript Tutorial For Beginners | JavaScript Training | JavaScript Programm...
 
Static and Dynamic webpage
Static and Dynamic webpageStatic and Dynamic webpage
Static and Dynamic webpage
 
Web Development Presentation
Web Development PresentationWeb Development Presentation
Web Development Presentation
 
Css3
Css3Css3
Css3
 
WEB I - 01 - Introduction to Web Development
WEB I - 01 - Introduction to Web DevelopmentWEB I - 01 - Introduction to Web Development
WEB I - 01 - Introduction to Web Development
 
CSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive DesignCSS3, Media Queries, and Responsive Design
CSS3, Media Queries, and Responsive Design
 
Java script
Java scriptJava script
Java script
 
An Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java ScriptAn Overview of HTML, CSS & Java Script
An Overview of HTML, CSS & Java Script
 

Viewers also liked

Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
Knoldus Inc.
 
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScriptAn Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
Troyfawkes
 
HTML CSS JavaScript jQuery Training
HTML CSS JavaScript jQuery TrainingHTML CSS JavaScript jQuery Training
HTML CSS JavaScript jQuery Training
ubshreenath
 
An Intro to HTML5 and CSS3
An Intro to HTML5 and CSS3An Intro to HTML5 and CSS3
An Intro to HTML5 and CSS3
Dhruva Krishnan
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
Dhruva Krishnan
 
Crowdsourcing Presentation for Creative Company Conference
Crowdsourcing Presentation for Creative Company ConferenceCrowdsourcing Presentation for Creative Company Conference
Crowdsourcing Presentation for Creative Company Conference
Trada
 
Animation powerpoint
Animation powerpointAnimation powerpoint
Animation powerpoint
Abbeyfield
 
my animation presentation (R&D module for university)
my animation presentation (R&D module for university)my animation presentation (R&D module for university)
my animation presentation (R&D module for university)
MichaelCX25
 
Turing Church Online Workshop 2
Turing Church Online Workshop 2Turing Church Online Workshop 2
Turing Church Online Workshop 2
Giulio Prisco
 
Presentation for Erasmusplus project LTSDU on PISA 2012 results in Italy
Presentation for Erasmusplus project LTSDU on PISA 2012 results in ItalyPresentation for Erasmusplus project LTSDU on PISA 2012 results in Italy
Presentation for Erasmusplus project LTSDU on PISA 2012 results in Italy
sisifo68
 
Taller heramientas multimedias
Taller heramientas multimediasTaller heramientas multimedias
Taller heramientas multimedias
Freddy Alexander Avendaño Benitez
 
Power Point Presentation
Power Point PresentationPower Point Presentation
Power Point Presentation
CharlCooper
 
Presentation - Animation B2B
Presentation - Animation B2BPresentation - Animation B2B
Presentation - Animation B2B
Pat Animation Studio
 
Animation presentation
Animation presentationAnimation presentation
Animation presentation
Rounak Muchhal
 
Presentation logo contest for ltsdu
Presentation logo contest for ltsduPresentation logo contest for ltsdu
Presentation logo contest for ltsdu
sisifo68
 
Intro to HTML5
Intro to HTML5Intro to HTML5
Intro to HTML5
Jussi Pohjolainen
 
Threads in PHP - Presentation
Threads in PHP - Presentation Threads in PHP - Presentation
Threads in PHP - Presentation
appserver.io
 
Core Php Component Presentation
Core Php Component PresentationCore Php Component Presentation
Core Php Component Presentation
John Coonen
 
PHP in one presentation
PHP in one presentationPHP in one presentation
PHP in one presentation
Milad Rahimi
 

Viewers also liked (20)

Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScriptAn Seo’s Intro to Web Dev, HTML, CSS and JavaScript
An Seo’s Intro to Web Dev, HTML, CSS and JavaScript
 
HTML CSS JavaScript jQuery Training
HTML CSS JavaScript jQuery TrainingHTML CSS JavaScript jQuery Training
HTML CSS JavaScript jQuery Training
 
An Intro to HTML5 and CSS3
An Intro to HTML5 and CSS3An Intro to HTML5 and CSS3
An Intro to HTML5 and CSS3
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
 
Crowdsourcing Presentation for Creative Company Conference
Crowdsourcing Presentation for Creative Company ConferenceCrowdsourcing Presentation for Creative Company Conference
Crowdsourcing Presentation for Creative Company Conference
 
Animation powerpoint
Animation powerpointAnimation powerpoint
Animation powerpoint
 
Animation powerpoint
Animation powerpointAnimation powerpoint
Animation powerpoint
 
my animation presentation (R&D module for university)
my animation presentation (R&D module for university)my animation presentation (R&D module for university)
my animation presentation (R&D module for university)
 
Turing Church Online Workshop 2
Turing Church Online Workshop 2Turing Church Online Workshop 2
Turing Church Online Workshop 2
 
Presentation for Erasmusplus project LTSDU on PISA 2012 results in Italy
Presentation for Erasmusplus project LTSDU on PISA 2012 results in ItalyPresentation for Erasmusplus project LTSDU on PISA 2012 results in Italy
Presentation for Erasmusplus project LTSDU on PISA 2012 results in Italy
 
Taller heramientas multimedias
Taller heramientas multimediasTaller heramientas multimedias
Taller heramientas multimedias
 
Power Point Presentation
Power Point PresentationPower Point Presentation
Power Point Presentation
 
Presentation - Animation B2B
Presentation - Animation B2BPresentation - Animation B2B
Presentation - Animation B2B
 
Animation presentation
Animation presentationAnimation presentation
Animation presentation
 
Presentation logo contest for ltsdu
Presentation logo contest for ltsduPresentation logo contest for ltsdu
Presentation logo contest for ltsdu
 
Intro to HTML5
Intro to HTML5Intro to HTML5
Intro to HTML5
 
Threads in PHP - Presentation
Threads in PHP - Presentation Threads in PHP - Presentation
Threads in PHP - Presentation
 
Core Php Component Presentation
Core Php Component PresentationCore Php Component Presentation
Core Php Component Presentation
 
PHP in one presentation
PHP in one presentationPHP in one presentation
PHP in one presentation
 

Similar to Html JavaScript and CSS

CHAPTER 3 JS (1).pptx
CHAPTER 3  JS (1).pptxCHAPTER 3  JS (1).pptx
CHAPTER 3 JS (1).pptx
achutachut
 
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
IT2255 Web Essentials - Unit III Client-Side Processing and ScriptingIT2255 Web Essentials - Unit III Client-Side Processing and Scripting
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
pkaviya
 
JavaScript_III.pptx
JavaScript_III.pptxJavaScript_III.pptx
JavaScript_III.pptx
rashmiisrani1
 
Iwt note(module 2)
Iwt note(module 2)Iwt note(module 2)
Iwt note(module 2)
SANTOSH RATH
 
Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]
srikanthbkm
 
JavaScript with Syntax & Implementation
JavaScript with Syntax & ImplementationJavaScript with Syntax & Implementation
JavaScript with Syntax & Implementation
Soumen Santra
 
Basic JavaScript Tutorial
Basic JavaScript TutorialBasic JavaScript Tutorial
Basic JavaScript Tutorial
DHTMLExtreme
 
Wt unit 5
Wt unit 5Wt unit 5
Wt unit 5
team11vgnt
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
ambuj pathak
 
JavaScript
JavaScriptJavaScript
JavaScript
Gulbir Chaudhary
 
Beginning AngularJS
Beginning AngularJSBeginning AngularJS
Beginning AngularJS
Troy Miles
 
Java script
Java scriptJava script
Java script
Rajkiran Mummadi
 
Basics of Java Script (JS)
Basics of Java Script (JS)Basics of Java Script (JS)
Basics of Java Script (JS)
Ajay Khatri
 
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPTHSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
AAFREEN SHAIKH
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java script
nanjil1984
 
AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep Dive
Gabriel Walt
 
FYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III JavascriptFYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III Javascript
Arti Parab Academics
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
dwm042
 
javascriptPresentation.pdf
javascriptPresentation.pdfjavascriptPresentation.pdf
javascriptPresentation.pdf
wildcat9335
 
Lect35 javascript
Lect35 javascriptLect35 javascript

Similar to Html JavaScript and CSS (20)

CHAPTER 3 JS (1).pptx
CHAPTER 3  JS (1).pptxCHAPTER 3  JS (1).pptx
CHAPTER 3 JS (1).pptx
 
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
IT2255 Web Essentials - Unit III Client-Side Processing and ScriptingIT2255 Web Essentials - Unit III Client-Side Processing and Scripting
IT2255 Web Essentials - Unit III Client-Side Processing and Scripting
 
JavaScript_III.pptx
JavaScript_III.pptxJavaScript_III.pptx
JavaScript_III.pptx
 
Iwt note(module 2)
Iwt note(module 2)Iwt note(module 2)
Iwt note(module 2)
 
Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]Vb script tutorial for qtp[1]
Vb script tutorial for qtp[1]
 
JavaScript with Syntax & Implementation
JavaScript with Syntax & ImplementationJavaScript with Syntax & Implementation
JavaScript with Syntax & Implementation
 
Basic JavaScript Tutorial
Basic JavaScript TutorialBasic JavaScript Tutorial
Basic JavaScript Tutorial
 
Wt unit 5
Wt unit 5Wt unit 5
Wt unit 5
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Beginning AngularJS
Beginning AngularJSBeginning AngularJS
Beginning AngularJS
 
Java script
Java scriptJava script
Java script
 
Basics of Java Script (JS)
Basics of Java Script (JS)Basics of Java Script (JS)
Basics of Java Script (JS)
 
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPTHSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
HSC INFORMATION TECHNOLOGY CHAPTER 3 ADVANCED JAVASCRIPT
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java script
 
AEM Sightly Deep Dive
AEM Sightly Deep DiveAEM Sightly Deep Dive
AEM Sightly Deep Dive
 
FYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III JavascriptFYBSC IT Web Programming Unit III Javascript
FYBSC IT Web Programming Unit III Javascript
 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
 
javascriptPresentation.pdf
javascriptPresentation.pdfjavascriptPresentation.pdf
javascriptPresentation.pdf
 
Lect35 javascript
Lect35 javascriptLect35 javascript
Lect35 javascript
 

Recently uploaded

NAEYC Code of Ethical Conduct Resource Book
NAEYC Code of Ethical Conduct Resource BookNAEYC Code of Ethical Conduct Resource Book
NAEYC Code of Ethical Conduct Resource Book
lakitawilson
 
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894
PECB
 
Unlocking Educational Synergy-DIKSHA & Google Classroom.pptx
Unlocking Educational Synergy-DIKSHA & Google Classroom.pptxUnlocking Educational Synergy-DIKSHA & Google Classroom.pptx
Unlocking Educational Synergy-DIKSHA & Google Classroom.pptx
bipin95
 
Ardra Nakshatra (आर्द्रा): Understanding its Effects and Remedies
Ardra Nakshatra (आर्द्रा): Understanding its Effects and RemediesArdra Nakshatra (आर्द्रा): Understanding its Effects and Remedies
Ardra Nakshatra (आर्द्रा): Understanding its Effects and Remedies
Astro Pathshala
 
National Learning Camp( Reading Intervention for grade1)
National Learning Camp( Reading Intervention for grade1)National Learning Camp( Reading Intervention for grade1)
National Learning Camp( Reading Intervention for grade1)
SaadaGrijaldo1
 
Webinar Innovative assessments for SOcial Emotional Skills
Webinar Innovative assessments for SOcial Emotional SkillsWebinar Innovative assessments for SOcial Emotional Skills
Webinar Innovative assessments for SOcial Emotional Skills
EduSkills OECD
 
SYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISING
SYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISINGSYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISING
SYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISING
Dr Vijay Vishwakarma
 
Understanding and Interpreting Teachers’ TPACK for Teaching Multimodalities i...
Understanding and Interpreting Teachers’ TPACK for Teaching Multimodalities i...Understanding and Interpreting Teachers’ TPACK for Teaching Multimodalities i...
Understanding and Interpreting Teachers’ TPACK for Teaching Multimodalities i...
Neny Isharyanti
 
AI_in_HR_Presentation Part 1 2024 0703.pdf
AI_in_HR_Presentation Part 1 2024 0703.pdfAI_in_HR_Presentation Part 1 2024 0703.pdf
AI_in_HR_Presentation Part 1 2024 0703.pdf
SrimanigandanMadurai
 
Chapter-2-Era-of-One-party-Dominance-Class-12-Political-Science-Notes-2 (1).pptx
Chapter-2-Era-of-One-party-Dominance-Class-12-Political-Science-Notes-2 (1).pptxChapter-2-Era-of-One-party-Dominance-Class-12-Political-Science-Notes-2 (1).pptx
Chapter-2-Era-of-One-party-Dominance-Class-12-Political-Science-Notes-2 (1).pptx
Brajeswar Paul
 
The basics of sentences session 9pptx.pptx
The basics of sentences session 9pptx.pptxThe basics of sentences session 9pptx.pptx
The basics of sentences session 9pptx.pptx
heathfieldcps1
 
BRIGADA ESKWELA OPENING PROGRAM KICK OFF.pptx
BRIGADA ESKWELA OPENING PROGRAM KICK OFF.pptxBRIGADA ESKWELA OPENING PROGRAM KICK OFF.pptx
BRIGADA ESKWELA OPENING PROGRAM KICK OFF.pptx
kambal1234567890
 
Configuring Single Sign-On (SSO) via Identity Management | MuleSoft Mysore Me...
Configuring Single Sign-On (SSO) via Identity Management | MuleSoft Mysore Me...Configuring Single Sign-On (SSO) via Identity Management | MuleSoft Mysore Me...
Configuring Single Sign-On (SSO) via Identity Management | MuleSoft Mysore Me...
MysoreMuleSoftMeetup
 
How to Configure Time Off Types in Odoo 17
How to Configure Time Off Types in Odoo 17How to Configure Time Off Types in Odoo 17
How to Configure Time Off Types in Odoo 17
Celine George
 
How to Install Theme in the Odoo 17 ERP
How to  Install Theme in the Odoo 17 ERPHow to  Install Theme in the Odoo 17 ERP
How to Install Theme in the Odoo 17 ERP
Celine George
 
How to Handle the Separate Discount Account on Invoice in Odoo 17
How to Handle the Separate Discount Account on Invoice in Odoo 17How to Handle the Separate Discount Account on Invoice in Odoo 17
How to Handle the Separate Discount Account on Invoice in Odoo 17
Celine George
 
NLC English 7 Consolidation Lesson plan for teacher
NLC English 7 Consolidation Lesson plan for teacherNLC English 7 Consolidation Lesson plan for teacher
NLC English 7 Consolidation Lesson plan for teacher
AngelicaLubrica
 
Front Desk Management in the Odoo 17 ERP
Front Desk  Management in the Odoo 17 ERPFront Desk  Management in the Odoo 17 ERP
Front Desk Management in the Odoo 17 ERP
Celine George
 
L1 L2- NLC PPT for Grade 10 intervention
L1 L2- NLC PPT for Grade 10 interventionL1 L2- NLC PPT for Grade 10 intervention
L1 L2- NLC PPT for Grade 10 intervention
RHODAJANEAURESTILA
 
Split Shifts From Gantt View in the Odoo 17
Split Shifts From Gantt View in the  Odoo 17Split Shifts From Gantt View in the  Odoo 17
Split Shifts From Gantt View in the Odoo 17
Celine George
 

Recently uploaded (20)

NAEYC Code of Ethical Conduct Resource Book
NAEYC Code of Ethical Conduct Resource BookNAEYC Code of Ethical Conduct Resource Book
NAEYC Code of Ethical Conduct Resource Book
 
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894
AI Risk Management: ISO/IEC 42001, the EU AI Act, and ISO/IEC 23894
 
Unlocking Educational Synergy-DIKSHA & Google Classroom.pptx
Unlocking Educational Synergy-DIKSHA & Google Classroom.pptxUnlocking Educational Synergy-DIKSHA & Google Classroom.pptx
Unlocking Educational Synergy-DIKSHA & Google Classroom.pptx
 
Ardra Nakshatra (आर्द्रा): Understanding its Effects and Remedies
Ardra Nakshatra (आर्द्रा): Understanding its Effects and RemediesArdra Nakshatra (आर्द्रा): Understanding its Effects and Remedies
Ardra Nakshatra (आर्द्रा): Understanding its Effects and Remedies
 
National Learning Camp( Reading Intervention for grade1)
National Learning Camp( Reading Intervention for grade1)National Learning Camp( Reading Intervention for grade1)
National Learning Camp( Reading Intervention for grade1)
 
Webinar Innovative assessments for SOcial Emotional Skills
Webinar Innovative assessments for SOcial Emotional SkillsWebinar Innovative assessments for SOcial Emotional Skills
Webinar Innovative assessments for SOcial Emotional Skills
 
SYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISING
SYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISINGSYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISING
SYBCOM SEM III UNIT 1 INTRODUCTION TO ADVERTISING
 
Understanding and Interpreting Teachers’ TPACK for Teaching Multimodalities i...
Understanding and Interpreting Teachers’ TPACK for Teaching Multimodalities i...Understanding and Interpreting Teachers’ TPACK for Teaching Multimodalities i...
Understanding and Interpreting Teachers’ TPACK for Teaching Multimodalities i...
 
AI_in_HR_Presentation Part 1 2024 0703.pdf
AI_in_HR_Presentation Part 1 2024 0703.pdfAI_in_HR_Presentation Part 1 2024 0703.pdf
AI_in_HR_Presentation Part 1 2024 0703.pdf
 
Chapter-2-Era-of-One-party-Dominance-Class-12-Political-Science-Notes-2 (1).pptx
Chapter-2-Era-of-One-party-Dominance-Class-12-Political-Science-Notes-2 (1).pptxChapter-2-Era-of-One-party-Dominance-Class-12-Political-Science-Notes-2 (1).pptx
Chapter-2-Era-of-One-party-Dominance-Class-12-Political-Science-Notes-2 (1).pptx
 
The basics of sentences session 9pptx.pptx
The basics of sentences session 9pptx.pptxThe basics of sentences session 9pptx.pptx
The basics of sentences session 9pptx.pptx
 
BRIGADA ESKWELA OPENING PROGRAM KICK OFF.pptx
BRIGADA ESKWELA OPENING PROGRAM KICK OFF.pptxBRIGADA ESKWELA OPENING PROGRAM KICK OFF.pptx
BRIGADA ESKWELA OPENING PROGRAM KICK OFF.pptx
 
Configuring Single Sign-On (SSO) via Identity Management | MuleSoft Mysore Me...
Configuring Single Sign-On (SSO) via Identity Management | MuleSoft Mysore Me...Configuring Single Sign-On (SSO) via Identity Management | MuleSoft Mysore Me...
Configuring Single Sign-On (SSO) via Identity Management | MuleSoft Mysore Me...
 
How to Configure Time Off Types in Odoo 17
How to Configure Time Off Types in Odoo 17How to Configure Time Off Types in Odoo 17
How to Configure Time Off Types in Odoo 17
 
How to Install Theme in the Odoo 17 ERP
How to  Install Theme in the Odoo 17 ERPHow to  Install Theme in the Odoo 17 ERP
How to Install Theme in the Odoo 17 ERP
 
How to Handle the Separate Discount Account on Invoice in Odoo 17
How to Handle the Separate Discount Account on Invoice in Odoo 17How to Handle the Separate Discount Account on Invoice in Odoo 17
How to Handle the Separate Discount Account on Invoice in Odoo 17
 
NLC English 7 Consolidation Lesson plan for teacher
NLC English 7 Consolidation Lesson plan for teacherNLC English 7 Consolidation Lesson plan for teacher
NLC English 7 Consolidation Lesson plan for teacher
 
Front Desk Management in the Odoo 17 ERP
Front Desk  Management in the Odoo 17 ERPFront Desk  Management in the Odoo 17 ERP
Front Desk Management in the Odoo 17 ERP
 
L1 L2- NLC PPT for Grade 10 intervention
L1 L2- NLC PPT for Grade 10 interventionL1 L2- NLC PPT for Grade 10 intervention
L1 L2- NLC PPT for Grade 10 intervention
 
Split Shifts From Gantt View in the Odoo 17
Split Shifts From Gantt View in the  Odoo 17Split Shifts From Gantt View in the  Odoo 17
Split Shifts From Gantt View in the Odoo 17
 

Html JavaScript and CSS

  • 2. History  What is the relationship between:  SGML  HTML  XHTML  CSS  JavaScript
  • 3. History  Markup  Annotations instructing how the document should appear in print  Word processors use different markup schemes  SGML IBM - Standard Generalized Markup Language Markup instructions stored with ASCII file  Any computer could render document  Lilly Example
  • 4. History  HTML  Tim Berners-Lee created HTML – subset of SGML  Not platform or application specific  Only server software needed to publish file s on the net  Structure versus content  Browser parses HTML file into a tree
  • 5. History  Sample HTML File  <FONT SIZE=14 FACE=Swing>  <B>Bryan Moore</B><BR>  </FONT>  <FONT SIZE=12 FACE=Textile>  1234 Sunset Ave. <BR>  Walla Walla, WA 12345 <BR>  (123)123.4567<BR>  </FONT> Web Applications and Real World Design - Knuckles
  • 6. History Browser parse tree Web Applications and Real World Design - Knuckles
  • 7. History  Problems with extracting data  Need to write a computer program to extract the names and addresses by selecting text strings following font tags  Content and structure of document become intertwined  Not the intention of SGML and original HTML  Cascading Style Sheets  Attempt to separate content and style
  • 8. History  CSS  Can alter the look of entire file with a simple coding change  Can keep styles in an external file  Increases the knowledge needed to code pages Initial rationale of HTML was to appeal to the masses
  • 9. History Parse tree using CSS Still need to reference Information based on “second string after BR” Information is not meaningful Web Applications and Real World Design - Knuckles
  • 10. History  Extensible Markup Language XML  Extensible- can create own tags  Complete separation of content and style Web Applications and Real World Design - Knuckles
  • 11. History  Releases  HTML 4.0 1997  XML 1.0 1998  XML and HTML need to better cooperate  XHTML 1.0 2000  XHTML  Contains elements and attributes of HTML  Elements must have closing tags  Lowercase  Attributes must have values  Attributes in single or double quotes  http://www.w3schools.com/xhtml/default.asp
  • 12. HTML Forms and JavaScript  Client Server Model  Client Side Processing  JavaScript downloaded from web page and processed by the client – typically form checking  JavaScript can interact directly with form data  Server Side processing  Information from a form sent to server for processing  PHP Perl C++  Server can interact directly with the form data
  • 13. HTML Forms and JavaScript  JavaScript  HTML files are text files  JavaScript is interpreted not compiled  Object oriented HTML forms are objects and can be manipulated via JavaScript Dynamic HTML – merger of JavaScript and HTML  Different implementations of DHTML by software companies
  • 14. What is JavaScript  Scripting language (object-oriented)  Lightweight programming language developed by Netscape  Interpreted, not compiled  Designed to be embedded in browsers        Ideal for adding interactivity to HTML pages Detect browser versions Work with info from user via HTML forms Create cookies Validate form data Read and write HTML elements Supported by all major browsers  Internet Explorer has JScript (started in IE3)  http://www.faqts.com/knowledge_base/view.phtml/aid/1380  It’s free, no license required
  • 15. What is JavaScript  Syntax is similar to Java, but it’s not Java per se  Usually JavaScript code is embedded within HTML code using the script tag:  Can have more than one pair of script tags in a page  Semicolons: C++ and JAVA require them but in JavaScript it’s optional
  • 16. What is JavaScript  HelloWorld example program…  <html>          <head><title>JavaScript HelloWorld! </title></head> <body> <script language="JavaScript"> document.write('Javascript says "Hello World!"') </script> </body> </html>  Let’s open it in the browser
  • 17. What is JavaScript  Javascript can be located in the head, body or external file  Head section Ensures script is loaded before trigger event  Body section Script executes when body loads  External Allows scripts to run on several pages  Examples: http://www.w3schools.com/js/js_whereto.asp
  • 18. What is JavaScript  JavaScript statements in head write to the beginning of the body section but don’t violate HTML code already there.  JavaScript statements in body write based on their location  JavaScript interpreted first then HTML interpreted second  Document.write writes to the HTML document not the web page
  • 19. What is JavaScript            <html> <head> <script language=“JavaScript”> document.write (“<b> This is first </b>); </script> </head> <body> Now where does this print on the web page???? <br /> <script language=“JavaScript”> document.write ( “This might be last?”) </script>   </body> </html>  Lets See what the answer is!
  • 20. What is JavaScript  Now, let JavaScript generate HTML for us…  <html>  <head><title>JavaScript HelloWorld!</title></head>  <body>  <script laguage="JavaScript">   document.write("<h2>Javascript-Generated output:</h2> <p>This paragraph generated by JavaScript</p>  <p>It can even insert an image</p>  <img src='../assigns/RayWeb/images/cathedral.jpg' />")   </script>  </body>  </html>  Let’s open it in the browser
  • 21. Identifier Etiquette  Identifier– The name of a variable (or function)  Starts with a letter, can contains digits & underscores  Case Sensitive!!  Should be meaningful to someone reading your code  Good: accountBalance, amountDue  Bad: bal, due,  Just plain wrong: 2bOrNotToBe, +var, total-value
  • 22. Variables  Must declare variables before they’re used in the program  Declare at the top of the program & terminate each statement with ‘;’  Intialize variables when appropriate  Local variables (declared within a function) destroyed after function exit.  Can only be accessed within the function  Example – Note Assignments  var candyBarPrice = 2.50;  var taxRate = .075;  var candyBarsPurchased;
  • 23. Assignment Operator  Assignment ‘looks like’ equal sign but does NOT behave like it  subTotal = subTotal + 1.50  subTotal ‘is assigned the value’ that is currently in subTotal plus the value of 1.50
  • 24. Expressions  An expression is a statement that describes a computation  Usually look like algebra formulas  total = subTotal * taxRate  Operators (+, -, *, /, etc.) have different levels of precedence, similar to algebra  Don’t rely on it! For clarity, use parentheses  w3Schools operator reference page
  • 25. Conditional Statements--if if (some boolean expression is true){ execute the statements within the curly braces, otherwise skip to the first statement after the closing brace } Resume execution here in either case
  • 26. Conditional Statements– if/else if (some boolean expression is true){ execute these statements, otherwise skip to ‘else’ clause } else { execute these statements if boolean expression is false } Resume execution here in either case
  • 27. Conditional Test Program  Diagnostic messages indicate flow of control 1. 2. 3. 4. var variable1 = 1; var variable2 = 2; 1. 2. if(variable1 > variable2){ if(variable1 >= 0){ document.write(“<p> 1 is greater than 0 </p>"); 5. } 6. document.write(“<p>Resuming execution after 'if' 7. statement</p>"); 8. 3. 4. 5. 6. • document.write(“<p>1 is greater than 2</p>"); } else { document.write(“<p>2 is greater than 1</p>"); } document.write("Resuming execution after
  • 28. Strings  Strings are sequences of keyboard characters enclosed in quotes  “Hello World” or ‘Hello World’  Variables can hold strings  var greeting = “Hello World”  String can be empty, i.e., contain no characters  var myAnswer = “”  Use ‘’ (escape symbol) to ‘type’ prohibited characters  b for backspace, n for newline, t for tab, ” for double quote
  • 29. JavaScript Functions – Basic Principles  Abstraction  Experience has taught us that much code is duplicated throughout program  Functions let us write the functionality once, then reuse it
  • 30. JavaScript Functions – Basic Principles  Encapsulation  Functions encapsulate a specific capability or feature  Function name allows us to access a function in our program  Parameterization  We can customize the function’s result by passing in different values each time we use it  Must use functions to write serious software!
  • 31. JavaScript Functions – Basic Principles  Reasons to use functions  Ease of communication  Problem simplification  Easier construction  Code readability  Reusability  Maintainability  In JS, functions are the primary encapsulation mechanism
  • 32. JavaScript Functions – Syntax  JS function syntax function myFunctionName (list of parameters) { ….JS code here… }
  • 33. JavaScript Functions -- Issues  Key issues about using functions  Naming functions  Passing in parameters  Using local variables within functions  How to call (i.e., invoke) functions  How to handle a function’s return value  Where to put JS functions in your webpage
  • 34. JavaScript Functions – Naming  Function names  Name describes what function does  Name is an identifier, so follow JS identifier syntax rules & course coding standards  Example, findMaxValue(‘put some parameters here’)
  • 35. JavaScript Functions -- Parameters  Passing parameters to the function  Parameters provide functions with input  Implicitly declared variables that can be accessed by code within function body  You provide actual input values when you call the function  Parameters are named variables separated by commas  Example, function findMaxValue(num1, num2, num3)
  • 36. JavaScript Functions – Where to put?  Put functions within <script>….</script> tags within the <head> section of the web page <head> <script language=“JavaScript”> declare functions here…. </script> </head>
  • 37. JavaScript Functions – Local Variables  If needed, you can declare local variables within a function  local variable is visible only within the function body after it’s declared  Commonly used to store results of an intermediate calculation
  • 38. JavaScript Functions – Local Variables function findMaxValue(num1, num2,num3) { var tempMax; //local var if (num1 >= num2) { tempMax = num1; } else { tempMax = num2; } if(num3 >= tempMax) { tempMax = num3; } return tempMax; } //end function
  • 39. JavaScript Functions -- Calling  To call a function from your program, add a statement that contains the function name with values for the parameters the function requires  Example…somewhere in the <body>…., var x = 1, y = 4, z = 2; findMaxValue(x, y, z);  What value does the function return?  What happens with the result?
  • 40. JavaScript Functions -- Return  Return keyword tells function to return some value and exit immediately  Function can have multiple return statements but only 1 can be executed in any given function call  Normally used to return the final result of a calculation to the calling program  For an example, see findMaxValue function
  • 41. JavaScript Functions -- Return  Good Example  Uses var maxNumber in calling program  Function’s return value is assigned to maxNumber  Display of maxNumber has correct value for inputs  Code snippet  var x = 1, y = 4, z = 2; var maxNumber = findMaxNumber(x, y, z); document.write(“The maximum is: “ + maxNumber);
  • 42. JavaScript Functions – Parameter Sequence  1. 2. 3. 4. 5. 6. 7. 1. 2. When calling functions, must enter parameters in same order as specified in function argument list. function calculateDensity(height, width, depth, mass){ var volume = height * width * depth; var density = mass / volume; return density; } ………………………………………………. var hth = 2, wth = 3, dth = 4, mass = 10; var result = calculateDensity(2, 10, 3, 4); //returns .07 but correct answer is .42!!!
  • 43. JavaScript Functions – Global Variables  Global variables are those declared outside of functions  Global variables are ‘visible’ from anywhere in the program, including inside functions var globalHello = “Hello!”; function writeHello() { document.write(globalHello); } // outputs “Hello!” Example program
  • 44. JavaScript Functions – Testing  Test each function thoroughly before proceeding with next programming task  Using multiple sets of inputs, be sure to test all possible outcomes  For each test, be sure calling program is properly handling return values
  • 45. JavaScript Functions – Debugging  Use diagnostic output statements to trace program execution  Good places for diagnostic outputs  Just before entering function  Immediately upon entering function  Before/In/After complex logic or computation  Just before function return statement  Immediately after function returns to calling program
  • 46. JavaScript Functions  Built-In Functions  Prompt  Alert  Confirm  http://www.w3schools.com/js/js_popup.asp
  • 47. JavaScript and HTML Forms  JavaScript Objects  Var truck = new Object();  Expression on right is a constructor  Properties truck.color=“white” document.write(color);  Primitives  In JavaScript variable primitive types are number, string and Boolean
  • 48. JavaScript and HTML Forms  Object Model for the Browser Window  Compound object structure is created when a web page loads into a browser Hierarchy  Window is an object, the HTML document is an object and its elements are objects  These objects have primitives associated with them
  • 49. JavaScript and HTML Forms  window [closed, location] history [length] document [bgColor, fgColor, URL, lastmodified,linkColor, vlinkColor]     images [properties] links [properties] frames [properties] forms [properties]
  • 50. JavaScript and HTML Forms  Window object is parent of structure  window.closed is primitive that is Boolean  window.location primitive contains string of the URL of the HTML file  window.document object is primary focus  When web page is loaded the HTML elements assign values to most of these window.document primitives  Often the word window is excluded as in document.write but need it if referring to multiple open windows  Properties can also be objects
  • 51. JavaScript and HTML Forms                   <HTML> <HEAD> <TITLE>Document Properties</TITLE> <SCRIPT LANGUAGE=JavaScript><!-document.write(closed); document.write("<BR>"+ document.bgColor); document.write("<BR>"+document.fgColor); document.write("<BR>"+document.lastModified); //--></SCRIPT> </HEAD> <BODY TEXT="#0000FF" BGCOLOR="#FFFFCC"> <P>Blue text on a yellow background.<BR> <SCRIPT LANGUAGE=JavaScript><!-document.write("<BR>"+ document.bgColor); document.write("<BR>"+document.fgColor); //--></SCRIPT> </BODY> </HTML> Interactive Programming on the Internet Knuckles
  • 52. JavaScript and HTML Forms  false #ffffff #000000 01/10/2001 17:18:30 Blue text on a yellow background. #ffffcc #0000ff Interactive Programming on the Internet, Knuckles
  • 53. JavaScript and HTML Forms  Methods  Behavior associated with an object  Essentially functions that perform an action  Some are built in and others user made  Built-In Methods of the window object  Confirm  Alert  Prompt
  • 54. JavaScript and HTML Forms  User Events  An event occurs when a user makes a change to a form element Ex. Click a button, mouseover an image  Detection of an event done by event handlers  Event handler is an attribute of the HTML button  <form> <input type=button value=“please click” onclick=“function name()”>  </form>
  • 55. JavaScript and HTML Forms <HTML> <HEAD> <SCRIPT LANGUAGE=JavaScript><!-function changecolor(){ document.bgColor="#ff0000"; } //--></SCRIPT> </HEAD> <BODY> <P><FORM > <P><INPUT TYPE=button VALUE="Click Me" onclick="changecolor()">  </FORM>  </BODY>  </HTML>            Interactive Programming on the Internet ,Knuckles
  • 56. JavaScript and HTML Forms  Form Object  Window.document.form  A form is a property of the document but is also an object  Form elements are properties of a form and are also objects  Access to form’s properties is done through the NAME attribute of the FORM tag  Access to the properties of the form elements is done through the NAME attributes of the particular form element
  • 57. JavaScript and HTML Forms Interactive Programming on the Internet ,Knuckles
  • 58. JavaScript and HTML Forms                          <HTML> <HEAD> <SCRIPT LANGUAGE=JavaScript><!-function plus(){ var n1; var n2; n1=document.addmult.num1.value; n2=document.addmult.num2.value; n1=parseFloat(n1); n2=parseFloat(n2); document.addmult.result.value=n1+n2; } function times(){ var n1; var n2; n1=document.addmult.num1.value; n2=document.addmult.num2.value; n1=parseFloat(n1); n2=parseFloat(n2); document.addmult.result.value=n1*n2; } Interactive Programming on the Internet ,Knuckles               //--></SCRIPT> </HEAD> <BODY BGCOLOR="#FFFFCC"> <P><FORM name=addmult> <P>Enter a number in each field: <INPUT TYPE=text NAME=num1 VALUE="" SIZE=5> <INPUT TYPE=text NAME=num2 VALUE="" SIZE=5><BR> <INPUT TYPE=button VALUE="+" onclick="plus()"> <INPUT TYPE=button VALUE="*" onclick="times()"><BR> <INPUT TYPE=reset VALUE="Reset Form"><BR> <TEXTAREA NAME=result ROWS=3 COLS=27 WRAP=virtual></TEXTAREA> </FORM> </BODY> </HTML>
  • 59. JavaScript and HTML Forms Form for submitting info for server side processing Interactive Programming on the Internet ,Knuckles
  • 60. JavaScript and HTML Forms                           <HTML> <HEAD> <SCRIPT LANGUAGE=JavaScript><!-function verify(){ with(document.infoform){ if((fullname.value=="")||(address.value=="")|| (email.value=="")){ alert("You have left one or more fields blank. Please supply the necessary information, and resubmit the form."); } else { display.value="The following information has been added to our guestbook:r"+fullname.value+"r"+ address.value +"r" +email.value; } } } //--></SCRIPT> </HEAD> <BODY BGCOLOR="#FFFFCC"> <P><FORM name=infoform> <P><TABLE BORDER=0> <TR> <TD WIDTH=83> <P>Name: </TD> <TD> <P><INPUT TYPE=text NAME=fullname VALUE="" SIZE=32> </TD> </TR>   <TR>    <TD WIDTH=83> <P>Address: </TD> <TD> <P><INPUT TYPE=text NAME=address VALUE="" SIZE=32> </TD> </TR> <TR> <TD WIDTH=83> <P>E-mail: </TD> <TD> <P><INPUT TYPE=text NAME=email VALUE="" SIZE=32> </TD> </TR> <TR> <TD WIDTH=83> <P><INPUT TYPE=button VALUE="Submit" onclick="verify()"> </TD> <TD> <P><INPUT TYPE=reset VALUE="Clear Your Information"> </TD> </TR> <TR> <TD COLSPAN=2> <P><TEXTAREA NAME=display ROWS=5 COLS=41 WRAP=virtual></TEXTAREA> </TD> </TR> </TABLE>    </FORM> </BODY> </HTML>                         

Editor's Notes

  1. To insert a JavaScript into an HTML page, we use the &lt;script&gt; tag (also use the type attribute to define the scripting language). So, the &lt;script type=&quot;text/javascript&quot;&gt; and &lt;/script&gt; tells where the JavaScript starts and ends: By entering the document.write command between the &lt;script type=&quot;text/javascript&quot;&gt; and &lt;/script&gt; tags, the browser will recognize it as a JavaScript command and execute the code line. In this case the browser will write Hello World! to the page: