Week 1 - Overview of HTML and Introduction to JavaScript

Similar documents
introduction to XHTML

Html basics Course Outline

Benefits of object-orientationorientation

CHAPTER 2 MARKUP LANGUAGES: XHTML 1.0

Chapter 1 Getting Started with HTML 5 1. Chapter 2 Introduction to New Elements in HTML 5 21

As we design and build out our HTML pages, there are some basics that we may follow for each page, site, and application.

Creating A Web Page. Computer Concepts I and II. Sue Norris

INTRODUCTION TO HTML5! HTML5 Page Structure!

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

CSC 121 Computers and Scientific Thinking

Web Development & Design Foundations with XHTML. Chapter 2 Key Concepts

BASICS OF WEB DESIGN CHAPTER 2 HTML BASICS KEY CONCEPTS

recall: a Web page is a text document that contains additional formatting information in the HyperText Markup Language (HTML)

How the Internet Works

Web Development and HTML. Shan-Hung Wu CS, NTHU

Programmazione Web a.a. 2017/2018 HTML5

c122jan2714.notebook January 27, 2014

Web Programming Week 2 Semester Byron Fisher 2018

A Balanced Introduction to Computer Science, 3/E

CSI 3140 WWW Structures, Techniques and Standards. Markup Languages: XHTML 1.0

Introduction to Web Technologies

Basics of Web Design, 3 rd Edition Instructor Materials Chapter 2 Test Bank

Understanding this structure is pretty straightforward, but nonetheless crucial to working with HTML, CSS, and JavaScript.

Unit 5 Web Publishing Systems Page 1 of 13 Part 4 HTML Part 4

Chapter 2:- Introduction to XHTML. Compiled By:- Sanjay Patel Assistant Professor, SVBIT.

Chapter 2 Creating and Editing a Web Page

Full file at New Perspectives on HTML and CSS 6 th Edition Instructor s Manual 1 of 13. HTML and CSS

Web Programming and Design. MPT Senior Cycle Tutor: Tamara Week 1

Hyper Text Markup Language HTML: A Tutorial

Introduction to WEB PROGRAMMING

Introduction to HTML. SSE 3200 Web-based Services. Michigan Technological University Nilufer Onder

HTML HTML. Chris Seddon CRS Enterprises Ltd 1

Brief Intro to HTML. CITS3403 Agile Web Development. 2018, Semester 1

11. HTML5 and Future Web Application

HTML: The Basics & Block Elements

LING 408/508: Computational Techniques for Linguists. Lecture 14

1. The basic building block of an HTML document is called a(n) a. tag. b. element. c. attribute. d. container. Answer: b Page 5

Web Publishing Basics I

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2017)

HTML. HTML Evolution

CSC Web Programming. Introduction to HTML

HTML. Mohammed Alhessi M.Sc. Geomatics Engineering. Internet GIS Technologies كلية اآلداب - قسم الجغرافيا نظم المعلومات الجغرافية

HTML and CSS Lecture 15 COMPSCI111/111G SS 2018

NEW WEBMASTER HTML & CSS FOR BEGINNERS COURSE SYNOPSIS

HTML MIS Konstantin Bauman. Department of MIS Fox School of Business Temple University

Creating Web Pages. Getting Started

HTML & XHTML Tag Quick Reference

XHTML & CSS CASCADING STYLE SHEETS

Student, Perfect Midterm Exam March 24, 2006 Exam ID: 3193 CS-081/Vickery Page 1 of 5

MPT Web Design. Week 1: Introduction to HTML and Web Design

Text and Layout. Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 11. This presentation 2004, MacAvon Media Productions

Certified HTML5 Developer VS-1029

LA TROBE UNIVERSITY SEMESTER ONE EXAMINATION PERIOD CAMPUS AW BE BU MI SH ALLOWABLE MATERIALS

Part 1: HTML Language HyperText Make-up Language

Lab 4 CSS CISC1600, Spring 2012

COMP519 Web Programming Lecture 3: HTML (HTLM5 Elements: Part 1) Handouts

1.264 Lecture 12. HTML Introduction to FrontPage

Announcements. Paper due this Wednesday

This document provides a concise, introductory lesson in HTML formatting.

COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2018)

HyperText Markup Language (HTML)

HTML and CSS COURSE SYLLABUS

Notes General. IS 651: Distributed Systems 1

Chapter 4 A Hypertext Markup Language Primer

Web Site Development with HTML/JavaScrip

HTML. LBSC 690: Jordan Boyd-Graber. October 1, LBSC 690: Jordan Boyd-Graber () HTML October 1, / 29

HTML. Hypertext Markup Language. Code used to create web pages

A Brief Introduction to HTML

HTML Overview formerly a Quick Review

Internet publishing HTML (XHTML) language. Petr Zámostný room: A-72a phone.:

Perfect Student Midterm Exam March 20, 2007 Student ID: 9999 Exam: 7434 CS-081/Vickery Page 1 of 5

c122sep814.notebook September 08, 2014 All assignments should be sent to Backup please send a cc to this address

What is a web site? Web editors Introduction to HTML (Hyper Text Markup Language)

CMT111-01/M1: HTML & Dreamweaver. Creating an HTML Document

GRAPHIC WEB DESIGNER PROGRAM

Final Exam Study Guide

Introduction to Web Development

Motivation (WWW) Markup Languages (defined). 7/15/2012. CISC1600-SummerII2012-Raphael-lec2 1. Agenda

Setup and Environment

Modify cmp.htm, contactme.htm and create scheduleme.htm

Management Information Systems

HTML TAG SUMMARY HTML REFERENCE 18 TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES TAG/ATTRIBUTE DESCRIPTION PAGE REFERENCES MOST TAGS

Chapter 10: Understanding the Standards

WML2.0 TUTORIAL. The XHTML Basic defined by the W3C is a proper subset of XHTML, which is a reformulation of HTML in XML.

A HTML document has two sections 1) HEAD section and 2) BODY section A HTML file is saved with.html or.htm extension

CIS 228 (Spring, 2012) Final, 5/17/12

HTMLandXHTML 5th Edition

AOS 452 Lab 4: HTML, CSS and Your Webpage

HTML Overview. With an emphasis on XHTML

Markup Language SGML: Standard Generalized Markup Language. HyperText Markup Language (HTML) extensible Markup Language (XML) TeX LaTeX

Introduction to using HTML to design webpages

Learning Objectives. Review html Learn to write a basic webpage in html Understand what the basic building blocks of html are

(Refer Slide Time: 01:41) (Refer Slide Time: 01:42)

What You Will Learn Today

Page Layout Using Tables

HYPERTEXT MARKUP LANGUAGE ( HTML )

IT350 Web & Internet Programming. Fall 2012

Document Object Model. Overview

CS 1124 Media computation. Lab 9.3 October 24, 2008 Steve Harrison

Course Overview. Week 1

Transcription:

ITEC 136 Business Programming Concepts Week 1 Module 1: Overview of HTML and Course overview Agenda This week s expected outcomes This week s topics This week s homework Upcoming deadlines Questions and answers 2

Course Overview Course Outcomes Explain the stages of the software lifecycle Design solutions using top-down stepwise refinement Implement solution algorithms using selection and repetition control structures structures Conditional constructs Looping constructs 3 Course Overview Course Outcomes Translate algorithms into clearly documented and modularized programming language code Document and Debug Code Generate and execute test plans 4

Books Course Overview Primary: JavaScript by Gosselin Secondary: Learning JavaScript by Powers Additional Key points on web site Web, tutorials, etc. 5 Course Overview Why is this important? Solid grounding in programming logic and design Understanding of the software development lifecycle Automation of tasks Pre-requisite requisite for other language-based coursework 6

Why JavaScript Ubiquitous on systems since 1996 Syntax derived from Java/C++ but is neither! Dynamic language change easily Key Component for Web 2.0 interfaces Can be embedded in other programs It can be fun! 7 JavaScript for Coding Why not language X or Y? Not a specific language-focused course Runs Within Internet Browser Principles apply to most languages Variables Functions Control structures Testing 8

Course Overview Course Structure Wet, lather, rinse, repeat. Wet, lather, rinse, repeat Lots of practice ( shampoo method) Reading FranklinLive presentations Homework Exercises Lab Exercises Two Exams Final exam Increasing difficulty and point value 9 Course Overview Tools you will need Aptana Integrated Development Environment (IDE) A standards-compliant web browser (Mozilla Firefox for use with Aptana) Firebug Your textbooks Patience and experimentation! 10

Other Useful Resources Safari Books Online http://www.safaribooksonline.com Also accessible through Franklin library online Google (or preferred search engine) Any number of web sites http://www.pageresource.com/ (tutorial) http://jennifermadden.com/ (tutorial) http://www.javascriptmall.com/learn/contents.htm (tutorial) http://www.squarefree.com/shell/ (sandbox) http://www.webreference.com/ (reference tutorial) http://www.visibone.com/ (fact sheets $) 11 Information packed spiral bound Covers VisiBone HTML/XHTML tags JavaScript CSS and Styles Fonts and Colors Document Object Model Regular Expressions 12

Week 1 Outcomes Create and display simple syntactically correct HTML documents Describe the execution a JavaScript program in a web browser 13 Week 1 Preparation Have You Already? Read Key Points on Course Web Site Read Chapter 1 in Both Books Reviewed the HTML Primer 14

HTML Primer How does the web work? Request and response cycle Text and binary transfer over HTTP Introduction 15 to JavaScript 15 HTML Primer How does the web work? Browser sends HTTP request as text GET /article.pl?sid=06/12/19/2256259/ HTTP/1.1 Host: it.slashdot.org Introduction 16 to JavaScript 16

HTML Primer How does the web work? Server sends back HTTP response HTTP/1.1 200 OK Date: Thu, 21 Dec 2006 21:31:30 GMT Content-Type: text/html Content-Length: 1354 <html> <body> <h1>should JavaScript Get More Respect?</h1> (more file contents).. </body> </html> Introduction 17 to JavaScript 17 HTML Primer How does the web work? Web browser parses document to identify and request other resources. Introduction 18 to JavaScript 18

HTTP and the Web Web browser renders the text as a formatted document based on HTML 19 HTML Primer HTML: HyperTextext Markup Language Use < and > to delimit an HTML element usually called a tag Open & Close tags around info <x>info</x> No element? Can use / in single tag, must have space prior to / <x /> 20

HTML Examples <title>javascript 101</title> <img src="pic.jpg" /> <img src="pic.jpg"></ ="pic.jpg"></img> <head><title>hello World</title></head> Two contrasting <img> tags. First is becoming more popular Can be nested. The <title> tag is inside the <head> tag 21 Full Document HTML Document structure <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html> <head> <title>should JavaScript Get More Respect?</title> </head> <body> <h1>should JavaScript Get More Respect?</h1> <p>an anonymous reader points out an article...</p> <!-- (more file contents) --> </body> </html> 22

Elements (tags) HTML Primer Element <html> <head> <title> <body> <h1> <p> Within <html> <head> <html> Purpose HTML content Page metadata Title of the page Page data <body> Heading level 1 <body> Paragraph data 23 Elements (tags) HTML Primer Element <div> <span> <ol> <ul> <li> <li> Within <html> <html> <html> <ol> <ul> Purpose Arbitrary page section Arbitrary inline section Ordered list Unordered list Numbered list item Bulleted list item 24

Elements (tags) HTML Primer Element <table> <tr> <td> <dl> <dt> <dd> Within <html> Purpose Table <table> Table row <tr> <html> <dl> <dl> Table data (cell) Definition list Definition term Definition data 25 Elements (tags) Element HTML Primer Within <br /> <html> <hr /> <html> Purpose Line break Horizontal rule <img /> Image (JPEG, GIF, PNG) <form> <html> <input /> <form> <script> Form for user input User input field (text, button) Executable code 26

HTML Entities Entities (special characters) Code Render " " & & < < &gt gt; > Code Render 27 A space, HTML typically ignores spaces and CRs in the HTML Attributes HTML Primer Parameters to elements <a href="http://franklin.edu/">franklin</a> Refines or further defines the tag href: hyperlink reference to another page. 28

Attributes HTML Primer Parameters to elements <div id="sidebar">as an aside...</div> id: internal identifier used to programmatically access and alter the division. 29 Attributes HTML Primer Parameters to elements <script type="text/javascript" language="javascript" src="employee.js"></script> type: programming language the script uses. language: default scripting language and version. src: file from which to read. 30

Attributes HTML Primer Parameters to elements <input type="text" name="last" id="last" /> Programming Tip Set id= and name= to the same value. Ex: id="txt" name="txt" type: kind of input control. name: field name sent to server. 31 Attributes HTML Primer Parameters to elements <img src="portrait.jpg" /> src: location of image file. 32

Try it out! Create a hobby page Specifications Title Picture Paragraph description Bulleted list with links to other hobby pages 33 Dynamic web pages HTML provides static content Client-side scripting provides Dynamic content Form validation Interactivity Special effects 34

Client-side scripting restrictions No access to the file system No network communication outside the originating domain JavaScript is case dependent 35 The <script> tag index.html 1. <script type="text/javascript"> 2. //<![CDATA[ 3. document.writeln("hello"); 4. //]]> Alternative style as W3C validate 5. </script> dislikes the CDATA method index.html 1. <script type="text/javascript" language="javascript"> 2. <!-- Hide script from old browsers. 3. // Put code below. 4. document.writeln("hello"); 5. // Stop hiding script from old browsers. --> 6. </script> 36

Hello world program index.html 1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTM...> 2. <html> 3. <head><title>hello World</title></head> 4. <body> 5. <script type="text/javascript" language="javascript"> 6. <!-- Hide script from old browsers. 7. document.write("<h1>hello World</h1>"); 8. // Stop hiding script from old browsers. --> 9. </script> 10. </body> 11. </html> 37 Hello world program index.html 1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTM...> 2. <html> 3. <head><title>hello World</title></head> 4. <body> 5. <script type="text/javascript" language="javascript"> 6. <!-- Hide script from old browsers. 7. document.write("<h1>hello World</h1>"); 8. // Stop hiding script from old browsers. --> 9. </script> 10. </body> 11. </html> 38

Comparing writeln() & write() document.writeln("<h1>hello World</h1>"); Appends a carriage return (in the HTML) document.write("<h1>hello World</h1>"); Does not append a carriage return. 39 JavaScript objects Calling object methods: noun.verb(parameters) document.writeln("<h1>hello World</h1>"); 40

JavaScript objects Calling object methods: noun.verb(parameters) document.writeln("<h1>hello World</h1>"); Object (noun) 41 JavaScript objects Calling object methods: noun.verb(parameters) Method (verb) document.writeln("<h1>hello World</h1>"); 42

JavaScript objects Calling object methods: noun.verb(parameters) document.writeln("<h1>hello World</h1>"); Parameter (extra needed information) 43 JavaScript objects Changing object properties: noun.property = new_value document.bgcolor = "#AABBCC"; 44

JavaScript objects Changing object properties: noun.property = new_value document.bgcolor = "#AABBCC"; Object (noun) 45 JavaScript objects Changing object properties: noun.property = new_value document.bgcolor = "#AABBCC"; Property (noun) 46

JavaScript objects Changing object properties: noun.property = new_value document.bgcolor = "#AABBCC"; New value for property 47 Prompting for input index.html 1. <script type="text/javascript"> 2. <!-- Hide script from old browsers. 3. var name = prompt("what is your name?"); 4. document.writeln("<h1>hello " 5. + name + "</h1>"); 6. // Stop hiding script from old browsers. --> 7. </script> 48

Prompting for input index.html 1. <script type="text/javascript"> 2. <!-- Hide script from old browsers. 3. var name = prompt("what is your name?"); 4. document.writeln("<h1>hello " 5. + name + "</h1>"); 6. // Stop hiding script from old browsers. --> 7. </script> 49 Prompting for input index.html 1. <script type="text/javascript"> 2. <!-- Hide script from old browsers. 3. var name = prompt("what is your name?"); 4. document.writeln("<h1>hello " 5. + name + "</h1>"); 6. // Stop hiding script from old browsers. --> 7. </script> The variable, name, temporarily holds the user input 50

Prompting for input index.html 1. <script type="text/javascript"> 2. <!-- Hide script from old browsers. 3. var name = prompt("what is your name?"); 4. document.writeln("<h1>hello " 5. + name + "</h1>"); 6. // Stop hiding script from old browsers. --> 7. </script> Whatever content the user typed is substituted for the variable. 51 Prompting for input index.html 1. <script type="text/javascript"> 2. <!-- Hide script from old browsers. 3. var name = prompt("what is your name?"); 4. document.writeln("<h1>hello " 5. + name + "</h1>"); 6. // Stop hiding script from old browsers. --> 7. </script> 52

External JavaScript files index.html 1. <script type="text/javascript" src="hello.js"> 2. </script> hello.js 1. var name = prompt("what is your name?"); 2. document.writeln("<h1>hello " + name + "</h1>"); 53 External JavaScript files index.html 1. <script type="text/javascript" src="hello.js"> 2. </script> hello.js 1. var name = prompt("what is your name?"); 2. document.writeln("<h1>hello " + name + "</h1>"); 54

Why use separate files? Keeps HTML (presentation) separated from JavaScript (programming logic) Allows many HTML pages to reuse a set of scripts Browsers can cache the files separately Browsers that don t understand JavaScript ignore it rather than render 55 JavaScript Placement Where should <script> be put? In the <head> section To load external scripts To define new functions In the <body> section To execute as or after the page loads 56

JavaScript Summary JavaScript is case dependent Use <script> for inline and external JavaScript code Hide script from older browsers by using HTML comments or the CDATA method around JavaScript code blocks Separate code into separate HTML and JS files 57 Try it out! Edit your hobby page to include A script in the body that prompts the user for their name, and then renders a custom welcome message using their name on your page. 58

Self Quiz What is the difference between a JavaScript method and a JavaScript property? How are HTML tags that have no matching closing tag written? Give an example. 59 Self Quiz What is one advantage of placing your JavaScript in a separate file versus writing it all in the HTML document? What does a DTD (Document Type Definition) do? What is the difference between an HTML attribute and an HTML tag? 60

ITEC 136 Business Programming Concepts Debugging Tools 61 Debugging Tools Old school approach Logging: debugging statements placed strategically in program code function log(div, message) { document.getelementbyid(div).innerhtml += message + "<br />"; } // then later... if (debug == true) { log("debug", "Got to here"); } 62

Debuggers Debugger: Programs that allow you to examine the state of another running program Built into the IDE Stop your program at a particular point ( (breakpoint) Inspect the contents of a variable (inspect or watch) Step through a program as it executes ( (step into, step over, step out) 63 Typical Debugging Session Set a breakpoint in your code just prior to where: You think a problem is occurring The Debugger has shown an error Run the program in debug mode, Debugger will suspend program at breakpoint 64

Typical Debugging Session Examine variables at breakpoint to determine what may have gone wrong. Use the watch or inspect features Step forward through the program line-by-line to examine how objects or variables change 65 Firebug Tutorial & Video http://getfirebug.com/ Links in Key Points (14.2) Firebug Tutorial #1 http://alternateidea.com/blog/articles/2006/05/12/an-in- depth-look-at-the-future-of-javascript-debugging-with-firebug http://alternateidea.com/blog/articles/2006/05/12/an-in-depth-look-at-the-future-of-javascript javascript-debugging-with-firebug Video Screencasts Excellent! http://www.digitalmediaminute.com/screencast/firebug-js/ http://files.jnewland.com/firebug.mov 66

Upcoming Deadlines Homework 1 due Jan 12 Readings for next week Chapter 2 in JavaScript Chapter 2 and part of chapter 3 in Learning JavaScript Module 2 Key Points - Software Life Cycle 67 Questions? Comments? Concerns? General Q & A 68