Web Programming Anselm Spoerri PhD (MIT) Rutgers University

Slides:



Advertisements
Similar presentations
JavaScript Part 6. Calling JavaScript functions on an event JavaScript doesn’t have a main function like other programming languages but we can imitate.
Advertisements

© Anselm SpoerriInfo + Web Tech Course Information Technologies Info + Web Tech Course Anselm Spoerri PhD (MIT) Rutgers University
© Anselm SpoerriInfo + Web Tech Course Information Technologies Info + Web Tech Course Anselm Spoerri PhD (MIT) Rutgers University
© Anselm SpoerriInfo + Web Tech Course Information Technologies Info + Web Tech Course Anselm Spoerri PhD (MIT) Rutgers University
© Anselm SpoerriInfo + Web Tech Course Information Technologies Info + Web Tech Course Anselm Spoerri PhD (MIT) Rutgers University
© Anselm SpoerriInfo + Web Tech Course Information Technologies Info + Web Tech Course Anselm Spoerri PhD (MIT) Rutgers University
© Anselm SpoerriInfo + Web Tech Course Information Technologies Info + Web Tech Course Anselm Spoerri PhD (MIT) Rutgers University
Programming Concepts MIT - AITI. Variables l A variable is a name associated with a piece of data l Variables allow you to store and manipulate data in.
© Anselm SpoerriDigital Media Production Digital Media Production Digital Media Production Anselm Spoerri PhD (MIT) Rutgers University
Programming games Examples: Audio example. Google Maps api. Classwork: show more complex video. Classwork/Homework: Find place (lat and long) for basic.
Google Maps API. Static Maps send an HTTP GET request receive an image (PNG, GIF, JPEG) no javascript needed encode params in URL example:
Arrays – What is it? – Creation – Changing the contents Functions – What is it? – Syntax – How they work – Anonymous functions A quick lesson in Objects.
JavaScript Programming B.Ramamurthy 6/113/2014B. Ramamurthy CSE6511.
Programming Games Google Map API examples. CSS. Classwork/homework: Catch up. Upload work. Show your [more] complex Google Maps API example. Plan your.
Introduction to JavaScript Gordon Tian
1 JavaScript in Context. Server-Side Programming.
CHAPTER 4 Java Script อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
© Anselm SpoerriInfo + Web Tech Course Information Technologies Info + Web Tech Course Anselm Spoerri PhD (MIT) Rutgers University
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
JavaScript, Fourth Edition
JavaScript. JavaScript is the programming language of HTML and the Web. Easy to learn One of the 3 languages of all developers MUST learn: 1. HTML to.
4. Javascript M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain.
© Anselm SpoerriDigital Media Production Digital Media Production Digital Media Production Anselm Spoerri PhD (MIT) Rutgers University
JavaScript. JavaScript Introduction JavaScript is the world's most popular programming language. It is the language for HTML and the web, for servers,
CGS 3066: Web Programming and Design Spring 2016 Programming in JavaScript.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
Javascript Basic Concepts Presentation By: Er. Sunny Chanday Lecturer CSE/IT RBIENT.
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
INTERNET APPLICATIONS CPIT405 JavaScript Instructor: Rasha AlOmari
Industry case study: Data Eric Brumer 2/19/2014. Agenda Belltower Books Belltower Books Trucking: backend & frontend Google maps & javascript.
Creating Databases Example using Google Maps API + file creation. Dollar sign problem. Classwork/Homework: [catch up]. Work on final project.
Google Maps API. Contents: 1. Google Maps API Key 2. Create a Basic Google Map 3. Google Maps Overlays 4. Google Maps Events 5. Google Maps Controls 6.
Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this.
WEB FOUNDATIONS CSS Overview. Outline  What is CSS  What does it do  Where are styles stored  Why use them  What is the cascade effect  CSS Syntax.
Build in Objects In JavaScript, almost "everything" is an object.
ISC440: Web Programming 2 Web APIs Google Maps API
Web Programming Anselm Spoerri PhD (MIT) Rutgers University
Getting Started with CSS
Programming Web Pages with JavaScript
Classes (Part 1) Lecture 3
Web Systems & Technologies
Chapter 4 Client-Side Programming: the JavaScript Language
>> Introduction to CSS
Human Computer Interaction
JavaScript is a programming language designed for Web pages.
Digital Media Production
Scope, Objects, Strings, Numbers
JavaScript Syntax and Semantics
Week#2 Day#1 Java Script Course
JavaScript: Array, Loop, Data File
Your 1st Programming Assignment
Introduction to Web programming
Information Technologies Anselm Spoerri PhD (MIT)
Event Driven Programming & User Defined Functions
Functions, Regular expressions and Events
Javascript Arrays.
JavaScript Programming Labs
JavaScript MCS/BCS.
JavaScript Basics What is JavaScript?
Javascript Chapter 19 and 20 5/3/2019.
JavaScript Intro.
Web Programming Anselm Spoerri PhD (MIT) Rutgers University
Web Programming Anselm Spoerri PhD (MIT) Rutgers University
Web Programming and Design
Programming Basics Review
Web Programming and Design
Web Programming and Design
Information Technologies Anselm Spoerri PhD (MIT)
Information Technologies Anselm Spoerri PhD (MIT)
Presentation transcript:

Web Programming Anselm Spoerri PhD (MIT) SC&I @ Rutgers University Info + Web Tech Course Web Programming Anselm Spoerri PhD (MIT) SC&I @ Rutgers University aspoerri@rutgers.edu

What to Do BEFORE Next Class Lecture 3 - Overview Quiz 1 Ex1 Lab JavaScript Objects Arrays DOM Google Maps API What to Do BEFORE Next Class JavaScript videos in Week 4 (in green)

Ex1 – Layout and Buttons

Ex1 – Interactivity + Function + Array + Counter Add Interactivity to Buttons onclick Create Function Name function “changeDisplay” Specify parameter = button name Create Global Array Increment array when specific button is pressed Button displays Counter Update button text to show how many times it has been pressed Only increment counter if different button has been pressed Create Layout “X” Clicking on “X” button will create “X” layout Modify DOM by assigning CSS rules to specific elements

JavaScript Objects Objects js_objects test yourself Properties (property) keys are used to access (property) values var car = {type:"Fiat", model:"500", color:"white"}; objectName.propertyName or objectName["propertyName"] car.type car["type"] Methods are stored in properties as function definitions var person = {firstName: "John", lastName : "Doe", fullName : function() { return this.firstName + " " + this.lastName; } }; objectName.methodName(); person.fullName(); js_objects test yourself

JavaScript Objects In JavaScript, almost "everything" is an object. Objects have Properties and Methods. new Object () versus { … } Object Literal Comma-separated list of name-value pairs wrapped in curly braces var literalObj = { prop1: 10, prop2: ‘hello’}; Object literals encapsulate data, enclosing it in tidy package. Minimizes use of global variables which can cause problems when combining code. Object Literal Syntax Colon : separates property name from value. Comma , separates each name-value pair from the next. No comma after the last name-value pair.

JavaScript – Objects and Arrays Arrays are always objects … a special kind of object Difference Between Arrays and Objects Arrays use numbered indexes items=[3,8]  items[1] Objects use named indexes car={type:“Fiat”}  car[“type”] Accessing Array for (i = 0; i < items.length; i++) { … items[i] … } items.forEach(myFunction); function myFunction (value, index, array) https://www.w3schools.com/js/tryit.asp?filename=tryjs_array_foreach

Google Maps API Get Google Maps API Key https://developers.google.com/maps/documentation/javascript/tutorial Get API Key Create Google Map https://developers.google.com/maps/documentation/javascript/tutorial google.maps.Map class Constructor: Map(mapDiv:Element,opts?:MapOptions) var map1 = new google.maps.Map ( document.getElementById('mapDiv'), objectLiteral); Google Maps Reference: https://developers.google.com/maps/documentation/javascript/reference#Map Change Center Point need to know Geocode: lat & lng Create Geocode – http://www.gpsvisualizer.com/geocode 4 Huntington Street, New Brunswick, NJ https://developers.google.com/maps/documentation/javascript/reference#MapOptions https://developers.google.com/maps/documentation/javascript/reference#LatLng new google.maps.LatLng(40.505, -74.453) or {lat: 40.505, lng: -74.453}

Google Maps API Change Map Type and Zoom Level Google Maps Reference: https://developers.google.com/maps/documentation/javascript/reference MapTypeId | MapOptions Object (specify keys) Chrome Console: map.getZoom (); Customize map: draggable: false; | scrollwheel: false; Add Marker https://developers.google.com/maps/documentation/javascript/examples/marker-simple https://developers.google.com/maps/documentation/javascript/reference#Marker google.maps.Marker class Constructor: Marker(opts?:MarkerOptions) var marker1 = new google.maps.Marker (objectLiteral); Add Info Window https://developers.google.com/maps/documentation/javascript/examples/infowindow-simple Next Steps Add more markers