Week 9

This Week • Javascript • Document Object Model • Ajax

Development of Interactivity • HTML – static web pages • PHP – dynamically generated web pages • Javascript – web pages with dynamic content

Javascript • Programming Language used in web design • Unlike PHP, executed client-side! • Javascript code is included in HTML passed to browser.

Javascript PHP

Javascript

Interpreted Loosely-typed Server-side execution Client-side execution

Javascript • Like CSS, may be included either within the HTML page or linked in from external .js file. • Linking in:

Variables in Javascript Initialization Global - x = 5; Local - var x = 5; Data Types number, boolean, string, object, undefined, null

Operators in Javascript + : Concatenation operator, joins two strings. == : Equality, can compare across types! typeof : Gives data type of value stored in a variable.

‘For Each’ Loop in Javascript weekdays*“Sunday”, “Monday”,...,”Saturday”+; for(int i = 0; i < 7; i++) for(var day in weekdays) { { weekdays[i]; day; } }

Events

Events • ‘Event handlers’ listen for an event and then execute code when that event happens. • Example: set up an ‘onclick’ event for a tag which does something when the content on the page is clicked by the user.

Document Object Model • Contents of web page represented in a structure called the Document Object Model. • We can access individual elements by Id in Javascript and get their contents! • Example: – name = document.getElementById(‘name’).value;

Development of Interactivity • HTML – static web pages • PHP – dynamically generated web pages • Javascript – web pages with dynamic content

• Ajax – dynamically load content from other pages

Ajax • Asynchronous Javascript and XML • Allows us to send requests to other pages for new content without reloading page!

Ajax Recipe for Ajax Calls: 1. Create ‘xhr’ object 2. Construct url 3. Optional: Display ‘loading’ icon. 4. Send out xhr: 1. Set up handler (do something on xhr.readyState == 4) 2. Open request 3. Send request

Javascript

PHP – dynamically generated web pages. • Javascript – web pages with dynamic content. Page 4. Javascript. • Programming Language used in web design.

401KB Sizes 3 Downloads 208 Views

Recommend Documents

Javascript
Javascript – web pages with dynamic content. Page 4. Javascript. • Programming Language used in web design. • Unlike PHP ... Create 'xhr' object. 2. Construct ...

[PDF BOOK] JAVASCRIPT: Easy JavaScript ...
Online PDF JAVASCRIPT: Easy JavaScript Programming For Beginners. Your Step-By-Step Guide to Learning JavaScript Programming (JavaScript Series), ...

Javascript Data Exploration - GitHub
Apr 20, 2016 - Designers. I'm a sort of. « social data scientist ». Paris. Sciences Po médialab. I just received a CSV. Let me grab my laptop ... Page 9 ...

JavaScript Test Runner
Jun 30, 2013 - 7.2.4 Integration with Browser Providers in the Cloud . .... 1GitHub is a web-based hosting service for software development projects that use ...... meta data about the project under test - about its source files. ...... |--thesis.pdf

JavaScript - Building Dynamic Websites
if (document.forms.login.username.value == "") ... document.forms.login.password.focus(); ... 19. Quirks http://www.quirksmode.org/js/contents.html ...

JavaScript Reference
fontsize("size") Changes the size of a string using font sizes 1 (smallest). - 7 (largest). ... Returns the Unicode or ASCII decimal value of the character at position ...

JavaScript Garden.pdf
JavaScript 파서의 잘못된 설계 때문에 구버전(ECMAScript 5 이전 버전)에서는 SystaxError가 발생할 것이다. 위 코드에서 문제가 되는 delete키워드를 따옴표로 ...

JavaScript Crash Course - GitHub
Nov 10, 2016 - 1Info on this slide from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures ..... Google (you are smart, figure it out).

JavaScript - Building Dynamic Websites
put cursor in username field if empty if (document.forms.login.username.value == ""). { document.forms.login.username.focus(); document.forms.login.username.value = document.forms.login.username.value;. } // else put cursor in password field else. {

Javascript khmer.pdf
JavaScript គឺ Script ែដលេធ . រេ3េល Web Browsers ដ ូេច&ះI. តDវនេ¡¢ Client-side. scripting language ផងែដរ។ Dynamic Webpages គឺFន features ...

JavaScript Reference
can be composed of letters, numerals, or the underscore character. • cannot contain blank ..... Returns the Unicode or ASCII decimal value of the character at ...

JavaScript Garden.pdf
Page 3 of 16. JavaScript Garden.pdf. JavaScript Garden.pdf. Open. Extract. Open with. Sign In. Main menu. Displaying JavaScript Garden.pdf. Page 1 of 16.

Modern JavaScript and PhoneGap - GitHub
ES3 (1999). iOS 3. By Source (WP:NFCC#4), Fair use, https://en.wikipedia.org/w/index.php?curid=49508224 ... Supported by all modern mobile web views. 1. iOS 6+, IE .... Arrow function returns. Single line arrow functions use implicit return: [1, 2, 3

javascript developer job.pdf
team skilled in entrepreneurship, sales, technology and product. development. Looking forward to meeting you! Contact: Matthias Funk Matthias Posch. [email protected] [email protected]. +43-650-5051567. Page 2 of 2. javascript developer job.pdf. jav