JavaScript Basics Three evening classes A, B and C

Slides:



Advertisements
Similar presentations
Working with Forms. how are forms manipulated? the document object contains an array of forms objects, one for each form, in document order –forms[] any.
Advertisements

Javascript It’s not JAVA. What do these all have in common?
JavaScript 101 Lesson 01: Writing Your First JavaScript.
Tutorial 10 Programming with JavaScript
INTRO TO MAKING A WEBSITE Mark Zhang.  HTML  CSS  Javascript  PHP  MySQL  …That’s a lot of stuff!
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
Agenda What is AJAX? What is jQuery? Demonstration/Tutorial Resources Q&A.
Making AJAX Easy with jQuery Chris Renner Health Systems Analyst Programmer & Informatics Manager VUMC Office of Grants & Contracts Management October.
Mr. Rouda’s CSCI 101 sections. What does a web page consist of? Code HTML, CSS, XHTML, XML, etc. Images Gif, jpg, png, etc. Plugins Swf, flv, etc. JavaScript.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Bridges To Computing General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. You are invited.
DHTML: Dynamic HTML Internet Technology1. What is DHTML? A collection of enhancements to HTML ► To create dynamic and interactive websites Combination.
Mr. Rouda’s CSCI 101 sections. What does a web page consist of? Code HTML, CSS, XHTML, XML, etc. Images Gif, jpg, png, etc. Plugins Swf, flv, etc. JavaScript.
Javascript. Outline Introduction Fundamental of JavaScript Javascript events management DOM and Dynamic HTML (DHTML)
Processing.js.
1 JavaScript in Context. Server-Side Programming.
Tutorial 10 Programming with JavaScript. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
Tutorial 10 Programming with JavaScript
Done by: Hanadi Muhsen1 Tutorial 1.  Learn the history of JavaScript  Create a script element  Write text to a Web page with JavaScript  Understand.
Page Load © Copyright 2014, Fred McClurg All Rights Reserved.
Introduction.  The scripting language most often used for client-side web development.  Influenced by many programming languages, easier for nonprogrammers.
Topic Java EE installation (Eclipse, glassfish, etc.) Eclipse configuration for EE Creating a Java Web Dynamic Project Creating your first servlet.
1 JavaScript in Context. Server-Side Programming.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
Javascript JavaScript is what is called a client-side scripting language:  a programming language that runs inside an Internet browser (a browser is also.
JavaScript Defined DOM (Document Object Model) General Syntax Body vs. Head Variables Math & Logic Selection Functions & Events Loops Animation Getting.
Chapter 2 Murach's JavaScript and jQuery, C2© 2012, Mike Murach & Associates, Inc.Slide 1.
USING JAVASCRIPT TO SHOW AN ALERT Web Design Sec 6-2 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
JavaScript and AJAX 2nd Edition Tutorial 1 Programming with JavaScript.
1 Using jQuery JavaScript & jQuery the missing manual (Second Edition)
HTML Structure & syntax
Getting Started with HTML
CGS 3066: Web Programming and Design Spring 2017
Chapter 4: Feature Detection & Drag and Drop
Programming Web Pages with JavaScript
Web Systems & Technologies
Using JavaScript to Show an Alert
Tutorial 10 Programming with JavaScript
© 2017 Akhilesh Bajaj, All Rights Reserved
Coding, Testing and Valdating a Web Page
Intro to HTML Mr. Singh.
Intro to JavaScript CS 1150 Spring 2017.
Intro to Web Development Class A Review
My web site..
CISC103 Web Development Basics: Web site:
DHTML Javascript Internet Technology.
Introduction to DOM.
JavaScript: How To? B. Ramamurthy.
DHTML Javascript Internet Technology.
Flight prices.
Code is on the Website Outline Comparison of Excel and R
Intro to Web Development HTML Structure
Intro to Web Development Links
Intro to Web Development Nesting Elements
JavaScript Basics Three evening classes A, B and C
Intro to Web Development First Web Page
Unit 6 part 3 Test Javascript Test.
Structuring Content in a Web Document
Intro to Web Development
Tutorial 10 Programming with JavaScript
Intro to Web Development Homework Review
For this assignment, copy and past the XHTML to a notepad file with the .html extension. Then add the code I ask for to complete the problems.
Javascript and JQuery SRM DSC.
HTML5 Session II Chapter 2 - How to Code, Test and Validate a Web Page Chapter 3 - How to Use HTML to Structure a Web Page
PHP an introduction.
Did someone say Music? January 23, 2019.
Murach's JavaScript and jQuery (3rd Ed.)
Creating dynamic/interactive web pages
Presentation transcript:

JavaScript Basics Three evening classes A, B and C Version 1.0 June 25, 2018

Website Analysis

Problem Analyze four commercial websites: Amazon.com Ebay.com Facebook.com Google.com For HTML, CSS and JavaScript Use

Step 1: Load the four websites Into Atom and save on Desktop

Step 2: Google.com Determine # of Lines of Code Go to end of file (Ctrl-End)

Step 3: Determine # of Lines of Code Repeat for Amazon, Facebook and Ebay Enter into Web Analysis Handout

Step 4: Google.com Determine # of HTML Comments Show “Find” Dialog (Ctrl-F)

Determine # of HTML Comments Repeat for Amazon, Facebook and Ebay Step 4: Determine # of HTML Comments Repeat for Amazon, Facebook and Ebay Enter into Web Analysis Handout

Step 5: Complete Web Analysis Handout

Step 6: Discuss

Problem Of the Desktop Web Pages Amazon.html Ebay.html Facebook.html Google.html Determine which are Useable (Use only absolute directory paths)

Look at JavaScript window Object Step 1 Problem Look at JavaScript window Object Step 1 Download window.html to Atom and Desktop from scottsdevelopers.com | Resources | Intro to JavaScript | Class C

window.html View in Atom and Chrome <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>The window object</title> </head> <script> function init() { var hotel1 = { chain:'Best Western', name:'The Retreat', numRooms: 24, hasPool: false } alert("Running JavaScript"); alert("Hotel 1 Chain: " + hotel1.chain); alert("Hotel 1 Name: " + hotel1.name); alert("Hotel 1 numRooms: " + hotel1.numRooms); alert("Hotel 1 hasPool: " + hotel1.hasPool); </script> <body onLoad="init()"> <p>Hello, Class!</p> </body> </html>

Step 2 Create window2.html by combining alert()s Test var msg = ""; msg += "Running Javascript" + "\n"; msg += "Hotel 1 Chain: " + hotel1.chain + "\n"; msg += "Hotel 1 Name: " + hotel1.name + "\n"; msg += "Hotel 1 numRooms: " + hotel1.numRooms + "\n"; msg += "Hotel 1 hasPool: " + hotel1.hasPool + "\n"; alert(msg);

Step 3 Create window3.html by Making English better before after var msg = ""; msg += "Running Javascript" + "\n"; msg += "Hotel 1 Chain: " + hotel1.chain + "\n"; msg += "Hotel 1 Name: " + hotel1.name + "\n"; msg += "Hotel 1 numRooms: " + hotel1.numRooms + "\n"; msg += "Hotel 1 hasPool: " + hotel1.hasPool + "\n"; alert(msg); var msg = "Hotel 1" + "\n"; msg += "Chain: " + hotel1.chain + "\n"; msg += "Hotel: " + hotel1.name + "\n"; msg += "# of Rooms: " + hotel1.numRooms + "\n"; if(hotel1.hasPool) { msg += "Pool? Yes" + "\n"; } else { msg += "Pool? No" + "\n"; } alert(msg);

Step 4 Create window4.html by from window2.html by refactoring Remove function init() from <script>, running all init() code directly Change all "\n" to "<br>" Remove onLoad="init()" from <body> Remove alert() from <script> After <p> add: <script> document.write(msg); </script>

Step 4 window4.html before after function init() { var hotel1 = { <script> function init() { var hotel1 = { . . . } alert(msg); </script> <body onLoad="init()"> <p>Hello, Class!</p> </body> <script> var hotel1 = { . . . </script> <body> <p>Hello, Class!</p> document.write(msg); </body>

Step 4 window4.html <script> var hotel1 = { chain:'Best Western', name:'The Retreat', numRooms: 24, hasPool: false } var msg = ""; msg += "Running Javascript" + "<br>"; msg += "Hotel 1 Chain: " + hotel1.chain + "<br>"; msg += "Hotel 1 Name: " + hotel1.name + "<br>"; msg += "Hotel 1 numRooms: " + hotel1.numRooms + "<br>"; msg += "Hotel 1 Has Pool? " + hotel1.hasPool + "<br>"; </script> </head> <body> <p>Hello, Class!</p> <script>document.write(msg);</script> </body>

Alternate Object syntax: <script> var hotel1 = { chain:'Best Western', name:'The Retreat', numRooms: 24, hasPool: false } alert("Hotel 1 chain: " + hotel1.chain ); alert("Hotel 1 chain: " + hotel1[chain] ); </script> Dot Notation

Alternate Object syntax: <script> var hotel1 = { chain:'Best Western', name:'The Retreat', numRooms: 24, hasPool: false } alert("Hotel 1 chain: " + hotel1.chain ); alert("Hotel 1 chain: " + hotel1[chain] ); </script> Object Notation

Step 5 window4.html Run JavaScript In Chrome Console Window for(var p in hotel1) alert(hotel1[p]);

Step 6 window5.html Run window5.html <script> var hotel1 = { chain:'Best Western', name:'The Retreat', numRooms: 24, hasPool: false } var msg = ""; for(var p in hotel1) { msg += p + "=" + hotel1[p] + "<br>"; </script> <body> <p>Hello, Class!</p> <script>document.write(msg);</script> </body>

Step 7 window6.html Run window6.html