EECS1012. Net-centric Introduction to Computing. Lecture Introduction to Javascript
|
|
- Brittney Horn
- 5 years ago
- Views:
Transcription
1 EECS 1012 Net-centric Introduction to Computing Lecture Introduction to Javascript Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and V. Kirst. Slides have been ported to PPT by Dr. Xenia Mountrouidou. These slides have been edited for, York University. The contents of these slides may be modified and redistributed, please give appropriate credit. M.S. Brown, EECS York University 1 (Creative Commons) Michael S. Brown, 2017.
2 2 Intro to JavaScript (JS)
3 Client-side scripting 3 JavaScript runs on the browser (so we call this "client side". JS provides a way to dynamically modify the HTML content and appearance in the browser.
4 Why use client-side programming? 4 PHP already allows us to create dynamic web pages. Why also use client-side scripting? client-side scripting (JavaScript) benefits: usability: can modify a page without having to post back to the server (faster UI) efficiency: can make small, quick (dynamic) changes to page without waiting for server event-driven: can respond to user actions like clicks and key presses EECS 1012
5 What is JavaScript? 5 a lightweight programming language ("scripting language") used to make web pages interactive insert dynamic text into HTML (ex: user name) react to events (ex: page load or user click) can get information about a user's computer (ex: browser type, history, etc) perform calculations on user's computer (e.g.: for form validation) EECS 1012
6 JavaScript (JS) vs. Java 6 JS is interpreted, Java is compiled JS has more relaxed syntax and rules fewer and "looser" data types variables don't need to be declared errors often silent (few exceptions) JS is contained within a web page and integrates with its HTML/CSS content EECS 1012
7 JavaScript vs. Java 7 + = (JavaScript is "mellow" version of Java) EECS 1012 Interestingly, even though the name has "Java" in it, JavaScript is not affiliated with Java (from Sun Microsystems that is now part of the Oracle Corporation).
8 JavaScript vs. PHP 8 differences: JS focuses on user interfaces and interacting with a document; PHP is geared toward HTML output and file/form processing JS code runs on the client's browser; PHP code runs on the web server EECS 1012
9 Linking to a JavaScript file: script 9 <script src="filename" type="text/javascript"></script> HTML script tag should be placed in HTML page's head script code is stored in a separate.js file JS code can be placed directly in the HTML file's body or head (like CSS) but this is bad style (should separate content, presentation, and behavior) EECS 1012
10 Event-driven programming 10 EECS
11 Event-driven programming 11 Event-driven programming: writing programs driven by user events Many programs (e.g. Java, C++, PHP) start when the program is started. JavaScript programs instead wait for user actions called events and respond to them EECS
12 An example: start with a button 12 <button>click me!</button> HTML button's text appears inside tag; can also contain images To make a responsive button or other UI control: 1. choose the control (e.g. button) and event (e.g. mouse click) of interest 2. write a JavaScript function to run when the event occurs 3. attach the function to the event on the control EECS 1012
13 Your first JavaScript statement: alert 13 alert(" remains my favorite class!"); JS a JS command that pops up a dialog box with a message The appearance of the "alert" may look different depending on the browser and operating system EECS 1012
14 Defining a JavaScript function 14 function functionname() { statement ; statement ;... statement ; } JS function myfunction() { alert(" remains my favorite class!"); } JS the above could be the contents of example.js linked to our HTML page statements placed into functions can be evaluated in response to user events
15 Event handlers in HTML 15 <element attributes onclick="function();">... HTML <button onclick="myfunction();">click me!</button> HTML Linking HTML to JavaScript JavaScript functions can be set as event handlers when you interact with the element, the function will execute onclick is just one of many event HTML attributes we'll use
16 Putting it together 16 HTML FILE <!DOCTYPE html> <html> <head> <script src="example.js" type="text/javascript"></script> </head> <body> <button onclick="myfunction();"> Click Me! </button> </body> </html> JS file: example.js Event (click) of the HTML button, calls the specified handler function This statement links in the JS file. The JS file has our JavaScript code. Like CSS, this is done by file name. function myfunction() { alert(" remains my favorite class!"); }
17 Effect of the previous code 17 When this button is clicked, the "alert" is called from the function.
18 18 JavaScript Language
19 JavaScript 19 If you are new to programming, you are going to notice that many of the things you see in JavaScript are almost the same as PHP In fact, most programming languages are quite similar and generally you can learn them quickly once you have experience in another language
20 Variables 20 var clientname = "Connie Client"; var age = 32; var id = ; Variables are defined by the keyword variable Unlike PHP, we not need $ for the variable name This may be confusing switching between PHP and JS
21 JS data types 21 TYPE Explanation Example Number Integers and floats are not distinguished in Java script 99, 2.8, 5, -10 String A variable that is a collection of characters. Hello, Boolean Array Objects function A variable that wholes only two possible values true or false. A variable that is actually a collection of variables that can be access with an index Objects are special data types that have functions and data associated with them. These are more common in JS than PHP and we will need to use them often. A user defined function that can be called by an user event (e.g. mouse click, etc) true or false [1,2,3,4, ] [ hello, deaner, ] Document.getElementByID(); (example of an object) function name () { statements;.. }
22 Number type 22 var enrollment = 99; var mediangrade = 2.8; var credits = (2 * 3); same operators at PHP: + - * / % = -= *= /= %= same order of precedence as PHP auto converts strings to number like PHP "2" * 3 = 6
23 String type 23 var s = "Connie Client"; var len = s.length; // 13 var s2 = 'Melvin Merchant'; Like PHP, strings can be specified with both " and ' Unlike, PHP, variables are not interpreted in "" There is a built in property.length that returns the string length
24 Object property access 24 var s = "Connie Client"; var len = s.length; variable s is of type String, however, this can also be thought of as a "String object". we can access various properties of the object using a "." and the property's name. You are going to see this type of property access often in JavaScript (and other "Object Oriented" languages)
25 String concatenation (+ operator) 25 var s1 = "Hello "; var s2 = "World \n"; var s3 = s1 + s3; // s3 = "Hello World \n"; The plus operator is used for string concatenation There is no. operator for strings like PHP The. operator will be used for accessing objects data. For example, previous slide: s.length was the length of a string. The escape sequences are similar to PHP \n, \", \'
26 JavaScript Access to the HTML page 26 JavaScript Functions Define functions that are called when events occur on the HTML page in the browser. DOM JS needs a mechanism to access the HTML document's structure. The solution: Document Object Model (DOM) HTML consists of elements. Now that you have learned forms, you know some elements can generated events (like data input & button clicks) JavaScript adds the ability to attach code that response to HTML events. It also needs a mechanism to access the HTML elements.
27 Document Object Model (DOM) 27 most JS code manipulates elements on an HTML page we can examine elements' "state" e.g. see whether a box is checked we can change state e.g. insert some new text into a div we can change styles e.g. make a paragraph red
28 28 DOM element objects
29 Object function call syntax 29 document.getelementbyid("id") Object "document" Call the object's function (also called a method) getelementbyid(...)
30 DOM element properties 30 Property Type Description classname id innerhtml style tagname string string string string string The class attribute of the element ("" if no class is set) The id attribute of the element (undefined if no id is set) The HTML markup and content inside the element, i.e. between its opening and close tags ("" if there is no content) An object representing the elements style attributes (see slide X) The element's HTML tag, in uppercase (e.g. "P", "DIV", "H1", "SPAN", etc) EECS 1012
31 Additional DOM properties 31 Property Type Description checked boolean whether a checkbox or radio button is checked disabled boolean Whether a form control is disabled href string The URL for a link (a) src string Source URL for an image (img) value string Text inside a form control such as an input or textarea EECS 1012
32 Accessing elements: 32 document.getelementbyid document.getelementbyid() returns the DOM object for an element with a given id can change the text inside most elements by setting the innerhtml property can change the text in form controls by setting the value property EECS
33 Example 33 replacetext.html <html> <head> <script src="replacetext.js" type="text/javascript"></script> </head> <body> <button onclick="changetext();">click me!</button> <p id="mytext"> Replace this text </p> </body> </html> replacetext.js function changetext() { var paragraph = document.getelementbyid("mytext"); paragraph.innerhtml = "Changed the text with JS!"; }
34 JS program breakdown 34 (1) Creates a button, links click event to JS function changetext() (1) Browser Output <body> <button onclick="changetext();">click me!</button> <p id="mytext"> Replace this text </p> </body> (2) (2) Creates a paragraph with ID mytext. You have seen this with CSS before. function changetext() { var paragraph = document.getelementbyid("mytext"); paragraph.innerhtml = "Changed the text with JS!"; } When the event happens. this code is executed. (1) Retrieves the element by ID name "mytext" (2) Changes its innerhtml data property. (1) (2) Browser Output
35 Accessing elements: 35 document.getelementbyid Previous example showed how to change the "innerhtml" property We can also change the style properties of the HTML element using JavaScript EECS
36 Changing element style: 36 element.style CSS Attribute color padding background-color border-top-width Font size Font famiy DOM Property / style object color padding backgroundcolor bordertopwidth fontsize fontfamily EECS 1012
37 Example 37 <html> changestyle.html <head> <script src="example2.js" type="text/javascript"></script> </head> <body> <button onclick="changetext();">change Style!</button> <span id="output">replace me</span> <input id="textbox" type="text"> </body> </html> changestyle.js function changetext() { var text = document.getelementbyid("textbox"); text.style.color = "blue"; /* Changes style color to blue */ text.style.fontsize = "3em"; /* Changes style fontsize to 3em */ text.style.fontfamily = "monospace"; /* Changes fontfamily to monospace */ }
38 Result from previous slide 38 After clicking button. We retrieve this element using the DOM getelementbyid(). <input id="textbox" type="text"> The input field id name is "textbox". function changetext() { var text = document.getelementbyid("textbox"); text.style.color = "blue"; text.style.fontsize = "3em"; text.style.fontfamily = "monospace"; } Change the style
39 39 More Javascript Syntax
40 Comments (same as Java) 40 // single-line comment /* multi-line comment */ JS identical to Java's comment syntax recall: 4 comment syntaxes HTML: <!-- comment --> CSS/JS/PHP: /* comment */ Java/JS/PHP: // comment PHP: # comment EECS 1012
41 More on JS string type 41 var count = 10; var s1 = "" + count; // "10" var s2 = count + " bananas, ah ah ah!"; // "10 bananas, ah ah ah!" var n1 = parseint("42 is the answer"); // 42 Number var n2 = parsefloat("3.403 is a test"); // Number Concatenation with an empty string is a quick way to convert a variable to a string (see var s1 example) Unlike PHP, if we want to convert a string to a number, we have to use a function parseint() /* means parse Integer*/ parsefloat() /* means parse Float */
42 Yet more on JS string type 42 var s = "a string"; var firstletter = s[0]; var firstletter = s.charat(0); var lastletter = s.charat(s.length - 1); // fails in IE // does work in IE One drawback of JavaScript is that it is not standardized across browsers Accessing characters in a string works like PHP for some browsers, e.g. s[0], s[1], s[2],... We can to use the s.charat(index) method. s.charat(0), s.charat(1), s.charat(2)
43 Special values: null and undefined 43 var ned = null; var benson = 9; // at this point in the code, // ned is null // benson's 9 // caroline is undefined JS undefined : has not been declared, does not exist null : exists, but was specifically assigned an empty or null value Why does JavaScript have both of these? EECS 1012
44 Logical operators same as PHP 44 > < >= <= &&! ==!= ===!== most logical operators automatically convert types: 5 < "7" is true 42 == 42.0 is true "5.0" == 5 is true === and!== are strict equality tests; checks both type and value "5.0" === 5 is false EECS 1012
45 if/else statement (same as PHP) 45 if (condition) { statements; } else if (condition) { statements; } else { statements; } JS identical structure to Java's if/else statement JavaScript allows almost anything as a condition EECS 1012
46 Boolean type 46 var ilike190m = true; var ieisgood = "IE6" > 0; // false if ("web devevelopment is great") { /* true */ } if (0) { /* false */ } any value can be used as a Boolean JS "falsey" values: 0, 0.0, NaN, "", null, and undefined "truthy" values: anything else converting a value into a Boolean explicitly: var boolvalue = Boolean(otherValue); var boolvalue =!!(othervalue); EECS 1012
47 for-loop (same as PHP andjava) 47 var sum = 0; for (var i = 0; i < 100; i++) { sum = sum + i; } JS var s1 = "hello"; var s2 = ""; for (var i = 0; i < s.length; i++) { s2 += s1.charat(i) + s1.charat(i); } // s2 stores "hheelllloo" JS EECS
48 while loops (same as PHP) 48 while (condition) { statements; } JS Example only difference from PHP is in the JS variable syntax. var i=0; var sum = 0; while (i < 100) { /* loops whie i is less than 100 */ sum = sum + i; /* adds up 0 to 99 */ i++; /* adds one to I */ } JS EECS
49 Popup boxes 49 alert("message"); // message confirm("message"); // returns true or false prompt("message"); // returns user input string JS EECS
50 Arrays 50 var name = []; // empty array var name = [value, value,..., value]; // pre-filled name[index] = value; // store element var ducks = ["Huey", "Dewey", "Louie"]; var stooges = []; // stooges.length is 0 stooges[0] = "Larry"; // stooges.length is 1 stooges[1] = "Moe"; // stooges.length is 2 stooges[4] = "Curly"; // stooges.length is 5 stooges[4] = "Shemp"; // stooges.length is 5 JS JS EECS 1012
51 Finish with another example (ver 1) 51 <html> add.html <head> <script src="add.js" type="text/javascript"></script> </head> <body> <h1>the Amazing Adder</h1> <div> <input id="num1" type="text" size="3"> + <input id="num2" type="text" size="3"> = <span id="answer"></span> <br> <button onclick="compute();">compute!</button> </div> </body> </html> function compute() { var input1 = document.getelementbyid("num1"); var input2 = document.getelementbyid("num2"); var answer = document.getelementbyid("answer"); var result = input1.value + input2.value; answer.innerhtml = result; } add.js
52 Finish with another example (ver 1) 52 <input id="num1" type="text" size="3"> + <input id="num2" type="text" size="3"> = <span id="answer"></span> <br> <button onclick="compute();">compute!</button> function compute() { var input1 = document.getelementbyid("num1"); var input2 = document.getelementbyid("num2"); var answer = document.getelementbyid("answer"); var result = input1.value + input2.value; answer.innerhtml = result; } There is an empty span here with id=answer The uses the DOM to get the elements. input1 and input2 are <input> so to access their data we use ".value". answer is a <span> so to change its value we use "innerhtml" Placed the results in the span elements "innerhtml"
53 But wait? 53 function compute() { var input1 = document.getelementbyid("num1"); var input2 = document.getelementbyid("num2"); var answer = document.getelementbyid("answer"); var result = input1.value + input2.value; answer.innerhtml = result; } Why is the answer "1010"? Because input1.value="10" and input2.value="10", are strings. So, "10" + "10" in JavaScript is "1010", because + is the concatenation operator. If we want to convert these, we need to use the function parseint( );
54 Finish with another example (ver 2) 54 <input id="num1" type="text" size="3"> + <input id="num2" type="text" size="3"> = <span id="answer"></span> <br> <button onclick="compute();">compute!</button> function compute() { var input1 = document.getelementbyid("num1"); var input2 = document.getelementbyid("num2"); var answer = document.getelementbyid("answer"); var result = parseint(input1.value) + parseint(input2.value); answer.innerhtml = result; } We only need to modify the JS code.
55 One more example <!DOCTYPE html> example3.html <html> <head> <script src="example3.js" type="text/javascript"></script> </head> <body> <p> Click image to see some of my favorite foods: <img onclick="changeimage();" src="dosa.jpg" height="100" id="food"></p> </body> </html> var i = 1; example3.js function changeimage() { var foodimage = document.getelementbyid("food"); var images = ["dosa.jpg", "falafel.jpg", "pide.jpg", "malaxiangguo.jpg"]; foodimage.src = images[i]; i++; if (i > 3) { i = 0; } }
56 Previous JS example 56 Attaches code to an "onclick" event for an image! Events do not have to be only for buttons! When the image is clicked, the code gets the image's element using the DOM and changes the images source An array of four images is used to store the image names A "global" variable is declared (outside the function) that keeps its value between function calls
57 Result of previous code 57 Each time you click the image, the image changes!
58 Recap 58 This lecture has introduced you to JavaScript The language is similar to PHP, however, variables syntax are different (no need for the $) Other differences with strings, arrays, etc.. but overall quite similar JS is also more object-oriented, so we have more object notation, e.g. var.innerhtml, var.style.color, etc. JS is also "event" driven, which we will explore more in coming lectures
CSc 337 LECTURE 5: GRID LAYOUT AND JAVASCRIPT
CSc 337 LECTURE 5: GRID LAYOUT AND JAVASCRIPT Layouts Flexbox - designed for one-dimensional layouts Grid - designed for two-dimensional layouts Grid Layout Use if you want rows and columns Works similarly
More informationCSc 337 LECTURE 6: JAVASCRIPT
CSc 337 LECTURE 6: JAVASCRIPT Client-side scripting client-side script: code runs in browser after page is sent back from server often this code manipulates the page or responds to user actions What is
More informationEECS1012. Net-centric Introduction to Computing. Lecture JavaScript DOM
EECS 1012 Net-centric Introduction to Computing Lecture JavaScript DOM Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and V. Kirst. Slides
More informationEECS1012. Net-centric Introduction to Computing. Lecture JavaScript DOM
EECS 1012 Net-centric Introduction to Computing Lecture JavaScript DOM Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and V. Kirst. Slides
More informationClient-side Web Programming Basics
INTERNET ENGINEERING Client-side Web Programming Basics Sadegh Aliakbary Agenda HTML Language CSS JavaScript Internet Engineering 2 HTML Building Websites HTML (HyperText Markup Language) The dominate
More informationEECS1012. Net-centric Introduction to Computing. Lecture JavaScript Events
EECS 1012 Net-centric Introduction to Computing Lecture JavaScript Events Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and V. Kirst.
More informationCSC Web Programming. Introduction to JavaScript
CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its
More informationJavaScript CS 4640 Programming Languages for Web Applications
JavaScript CS 4640 Programming Languages for Web Applications 1 How HTML, CSS, and JS Fit Together {css} javascript() Content layer The HTML gives the page structure and adds semantics Presentation
More informationEECS1012. Net-centric Introduction to Computing. Lecture 3: CSS for Styling
EECS1012 Net-centric Introduction to Computing Lecture 3: CSS for Styling Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and V. Kirst.
More informationCOMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2017)
COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2017) RAMANA ISUKAPALLI RAMANA@CS.COLUMBIA.EDU 1 LECTURE-1 Course overview See http://www.cs.columbia.edu/~ramana Overview of HTML Formatting, headings,
More informationWeb Programming Step by Step
Web Programming Step by Step Lecture 14 DOM and Timers Reading: 7.2-7.3; 8.2; 9.2.6 Except where otherwise noted, the contents of this presentation are Copyright 2009 Marty Stepp and Jessica Miller. Problems
More informationJavaScript CS 4640 Programming Languages for Web Applications
JavaScript CS 4640 Programming Languages for Web Applications 1 How HTML, CSS, and JS Fit Together {css} javascript() Content layer The HTML gives the page structure and adds semantics Presentation
More informationWeb Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh
Web Programming and Design MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh Plan for the next 5 weeks: Introduction to HTML tags, creating our template file Introduction to CSS and style
More informationIntroduction to using HTML to design webpages
Introduction to using HTML to design webpages #HTML is the script that web pages are written in. It describes the content and structure of a web page so that a browser is able to interpret and render the
More informationJavaScript: Introduction, Types
JavaScript: Introduction, Types Computer Science and Engineering College of Engineering The Ohio State University Lecture 19 History Developed by Netscape "LiveScript", then renamed "JavaScript" Nothing
More informationMobile Site Development
Mobile Site Development HTML Basics What is HTML? Editors Elements Block Elements Attributes Make a new line using HTML Headers & Paragraphs Creating hyperlinks Using images Text Formatting Inline styling
More informationLecture : 3. Practical : 2. Course Credit. Tutorial : 0. Total : 5. Course Learning Outcomes
Course Title Course Code WEB DESIGNING TECHNOLOGIES DCE311 Lecture : 3 Course Credit Practical : Tutorial : 0 Total : 5 Course Learning Outcomes At end of the course, students will be able to: Understand
More informationJAVASCRIPT BASICS. Type-Conversion in JavaScript. Type conversion or typecasting is one of the very important concept in
Type-Conversion in JavaScript Description Type conversion or typecasting is one of the very important concept in JavaScript. It refers to changing an entity or variable from one datatype to another. There
More informationCOMP519 Web Programming Lecture 16: JavaScript (Part 7) Handouts
COMP519 Web Programming Lecture 16: JavaScript (Part 7) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool
More informationCISC 1600 Lecture 2.4 Introduction to JavaScript
CISC 1600 Lecture 2.4 Introduction to JavaScript Topics: Javascript overview The DOM Variables and objects Selection and Repetition Functions A simple animation What is JavaScript? JavaScript is not Java
More informationEECS1012. Net-centric Introduction to Computing. Lecture 5: Yet more CSS (Float and Positioning)
EECS 1012 EECS1012 Net-centric Introduction to Computing Lecture 5: Yet more CSS (Float and Positioning) Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M.
More informationJavaScript: More Syntax and Using Events
JavaScript: Me Syntax and Using Events CISC 282 October 4, 2017 null and undefined null is synonymous with nothing i.e., no value, nothing there undefined in synonymous with confusion i.e., what's this?
More information1. Cascading Style Sheet and JavaScript
1. Cascading Style Sheet and JavaScript Cascading Style Sheet or CSS allows you to specify styles for visual element of the website. Styles specify the appearance of particular page element on the screen.
More informationINTRODUCTION TO JAVASCRIPT
INTRODUCTION TO JAVASCRIPT Overview This course is designed to accommodate website designers who have some experience in building web pages. Lessons familiarize students with the ins and outs of basic
More informationCIS 228 (Spring, 2012) Final, 5/17/12
CIS 228 (Spring, 2012) Final, 5/17/12 Name (sign) Name (print) email I would prefer to fail than to receive a grade of or lower for this class. Question 1 2 3 4 5 6 7 8 9 A B C D E TOTAL Score CIS 228,
More informationCOMS 469: Interactive Media II
COMS 469: Interactive Media II Agenda Review Data Types & Variables Decisions, Loops, and Functions Review gunkelweb.com/coms469 Review Basic Terminology Computer Languages Interpreted vs. Compiled Client
More informationPrincess Nourah bint Abdulrahman University. Computer Sciences Department
Princess Nourah bint Abdulrahman University 1 And use http://www.w3schools.com/ JavaScript Objectives Introduction to JavaScript Objects Data Variables Operators Types Functions Events 4 Why Study JavaScript?
More informationCGS 3066: Spring 2015 JavaScript Reference
CGS 3066: Spring 2015 JavaScript Reference Can also be used as a study guide. Only covers topics discussed in class. 1 Introduction JavaScript is a scripting language produced by Netscape for use within
More informationWeb Design & Dev. Combo. By Alabian Solutions Ltd , 2016
Web Design & Dev. Combo By Alabian Solutions Ltd 08034265103, info@alabiansolutions.com www.alabiansolutions.com 2016 HTML PART 1 Intro to the web The web Clients Servers Browsers Browser Usage Client/Server
More informationClient vs Server Scripting
Client vs Server Scripting PHP is a server side scripting method. Why might server side scripting not be a good idea? What is a solution? We could try having the user download scripts that run on their
More informationHTML User Interface Controls. Interactive HTML user interfaces. Document Object Model (DOM)
Page 1 HTML User Interface Controls CSE 190 M (Web Programming), Spring 2007 University of Washington Reading: Sebesta Ch. 5 sections 5.1-5.7.2, Ch. 2 sections 2.9-2.9.4 Interactive HTML user interfaces
More informationChapter4: HTML Table and Script page, HTML5 new forms. Asst. Prof. Dr. Supakit Nootyaskool Information Technology, KMITL
Chapter4: HTML Table and Script page, HTML5 new forms Asst. Prof. Dr. Supakit Nootyaskool Information Technology, KMITL Objective To know HTML5 creating a new style form. To understand HTML table benefits
More informationA Balanced Introduction to Computer Science, 3/E
A Balanced Introduction to Computer Science, 3/E David Reed, Creighton University 2011 Pearson Prentice Hall ISBN 978-0-13-216675-1 Chapter 4 JavaScript and Dynamic Web Pages 1 Static vs. Dynamic Pages
More informationBEFORE CLASS. If you haven t already installed the Firebug extension for Firefox, download it now from
BEFORE CLASS If you haven t already installed the Firebug extension for Firefox, download it now from http://getfirebug.com. If you don t already have the Firebug extension for Firefox, Safari, or Google
More informationJavaScript: The Basics
JavaScript: The Basics CISC 282 October 4, 2017 JavaScript A programming language "Lightweight" and versatile Not universally respected Appreciated in the web domain Adds programmatic functionality to
More informationHTML 5 and CSS 3, Illustrated Complete. Unit L: Programming Web Pages with JavaScript
HTML 5 and CSS 3, Illustrated Complete Unit L: Programming Web Pages with JavaScript Objectives Explore the Document Object Model Add content using a script Trigger a script using an event handler Create
More informationSuch JavaScript Very Wow
Such JavaScript Very Wow Lecture 9 CGS 3066 Fall 2016 October 20, 2016 JavaScript Numbers JavaScript numbers can be written with, or without decimals. Extra large or extra small numbers can be written
More informationControlled Assessment Task. Question 1 - Describe how this HTML code produces the form displayed in the browser.
Controlled Assessment Task Question 1 - Describe how this HTML code produces the form displayed in the browser. The form s code is displayed in the tags; this creates the object which is the visible
More informationCECS 189D EXAMINATION #1
CECS 189D EXAMINATION #1 SPRING 10 70 points MULTIPLE CHOICE 2 points for each correct answer Identify the choice that best answers the question on a Scantron 882 with a pencil #2. When you're on the campus
More informationCOMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2018)
COMS W3101: SCRIPTING LANGUAGES: JAVASCRIPT (FALL 2018) RAMANA ISUKAPALLI RAMANA@CS.COLUMBIA.EDU 1 LECTURE-1 Course overview See http://www.cs.columbia.edu/~ramana Overview of HTML Formatting, headings,
More informationChapter 9: Simple JavaScript
Chapter 9: Simple JavaScript Learning Outcomes: Identify the benefits and uses of JavaScript Identify the key components of the JavaScript language, including selection, iteration, variables, functions
More informationITS331 Information Technology I Laboratory
ITS331 Information Technology I Laboratory Laboratory #11 Javascript and JQuery Javascript Javascript is a scripting language implemented as a part of most major web browsers. It directly runs on the client's
More informationUI Course HTML: (Html, CSS, JavaScript, JQuery, Bootstrap, AngularJS) Introduction. The World Wide Web (WWW) and history of HTML
UI Course (Html, CSS, JavaScript, JQuery, Bootstrap, AngularJS) HTML: Introduction The World Wide Web (WWW) and history of HTML Hypertext and Hypertext Markup Language Why HTML Prerequisites Objective
More informationStudent, Perfect Final Exam May 25, 2006 ID: Exam No CS-081/Vickery Page 1 of 6
Student, Perfect Final Exam May 25, 2006 ID: 9999. Exam No. 3193 CS-081/Vickery Page 1 of 6 NOTE: It is my policy to give a failing grade in the course to any student who either gives or receives aid on
More informationPlace User-Defined Functions in the HEAD Section
JavaScript Functions Notes (Modified from: w3schools.com) A function is a block of code that will be executed when "someone" calls it. In JavaScript, we can define our own functions, called user-defined
More informationWeb Programming/Scripting: JavaScript
CS 312 Internet Concepts Web Programming/Scripting: JavaScript Dr. Michele Weigle Department of Computer Science Old Dominion University mweigle@cs.odu.edu http://www.cs.odu.edu/~mweigle/cs312-f11/ 1 Outline!
More informationCreating HTML files using Notepad
Reference Materials 3.1 Creating HTML files using Notepad Inside notepad, select the file menu, and then Save As. This will allow you to set the file name, as well as the type of file. Next, select the
More information710 Index Attributes, 127 action attribute, 263 assigning, bottom attribute, domain name attribute, 481 expiration date attribute, 480 8
INDEX Symbols = (assignment operator), 56 \ (backslash), 33 \b (backspace), 33 \" (double quotation mark), 32 \e (escape), 33 \f (form feed), 33
More informationProgrammazione Web a.a. 2017/2018 HTML5
Programmazione Web a.a. 2017/2018 HTML5 PhD Ing.Antonino Raucea antonino.raucea@dieei.unict.it 1 Introduzione HTML HTML is the standard markup language for creating Web pages. HTML stands for Hyper Text
More informationThe ActionScript Markup Language
/[PLT]*/ presents: The ActionScript Markup Language Nathan Rogan Shaun Salzberg Anand Rajeswaran Sergio Biasi Team Member : Nathan Role : Project Manager System Architect System Integrator Programmer ASML
More informationIntroduction to WEB PROGRAMMING
Introduction to WEB PROGRAMMING Web Languages: Overview HTML CSS JavaScript content structure look & feel transitions/animation s (CSS3) interaction animation server communication Full-Stack Web Frameworks
More informationCOMP284 Scripting Languages Lecture 14: JavaScript (Part 1) Handouts
COMP284 Scripting Languages Lecture 14: JavaScript (Part 1) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool
More informationJavaScript: More Syntax
JavaScript: More Syntax CISC 282 October 23, 2018 null and undefined What s the difference? null is synonymous with nothing i.e., no value, nothing there undefined is synonymous with the unknown i.e.,
More informationTizen Web UI Technologies (Tizen Ver. 2.3)
Tizen Web UI Technologies (Tizen Ver. 2.3) Spring 2015 Soo Dong Kim, Ph.D. Professor, Department of Computer Science Software Engineering Laboratory Soongsil University Office 02-820-0909 Mobile 010-7392-2220
More informationLECTURE-2. Functions review HTML Forms. Arrays Exceptions Events. CS3101: Scripting Languages: Javascript Ramana Isukapalli
LECTURE-2 Functions review HTML Forms Arrays Exceptions Events 1 JAVASCRIPT FUNCTIONS, REVIEW Syntax function (params) { // code Note: Parameters do NOT have variable type. 1. Recall: Function
More informationc122mar413.notebook March 06, 2013
These are the programs I am going to cover today. 1 2 Javascript is embedded in HTML. The document.write() will write the literal Hello World! to the web page document. Then the alert() puts out a pop
More informationExercise 1: Basic HTML and JavaScript
Exercise 1: Basic HTML and JavaScript Question 1: Table Create HTML markup that produces the table as shown in Figure 1. Figure 1 Question 2: Spacing Spacing can be added using CellSpacing and CellPadding
More informationJavaScript: Events, DOM and Attaching Handlers
JavaScript: Events, DOM and Attaching Handlers CISC 282 October 11, 2017 Keyboard and Text Events Name The User Must Applicable Elements blur remove focus , ,... focus apply focus , ,...
More informationWeek 13 Thursday (with Page 5 corrections)
Week 13 Thursday (with Page 5 corrections) Quizzes: HTML/CSS and JS available and due before 10 pm next Tuesday, May 1 st. You may do your own web research to answer, but do not ask classmates, friends,
More informationPES DEGREE COLLEGE BANGALORE SOUTH CAMPUS 1 K.M. before Electronic City, Bangalore WEB PROGRAMMING Solution Set II
PES DEGREE COLLEGE BANGALORE SOUTH CAMPUS 1 K.M. before Electronic City, Bangalore 560 100 WEB PROGRAMMING Solution Set II Section A 1. This function evaluates a string as javascript statement or expression
More informationINLEDANDE WEBBPROGRAMMERING MED JAVASCRIPT INTRODUCTION TO WEB PROGRAMING USING JAVASCRIPT
INLEDANDE WEBBPROGRAMMERING MED JAVASCRIPT INTRODUCTION TO WEB PROGRAMING USING JAVASCRIPT ME152A L4: 1. HIGHER ORDER FUNCTIONS 2. REGULAR EXPRESSIONS 3. JAVASCRIPT - HTML 4. DOM AND EVENTS OUTLINE What
More informationWeb Programming Step by Step
Web Programming Step by Step Lecture 15 Unobtrusive JavaScript Reading: 8.1-8.3 Except where otherwise noted, the contents of this presentation are Copyright 2009 Marty Stepp and Jessica Miller. 8.1: Global
More informationWeb Site Development with HTML/JavaScrip
Hands-On Web Site Development with HTML/JavaScrip Course Description This Hands-On Web programming course provides a thorough introduction to implementing a full-featured Web site on the Internet or corporate
More informationProduced by. App Development & Modeling. BSc in Applied Computing. Eamonn de Leastar
App Development & Modeling BSc in Applied Computing Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie
More informationSEEM4570 System Design and Implementation Lecture 03 JavaScript
SEEM4570 System Design and Implementation Lecture 03 JavaScript JavaScript (JS)! Developed by Netscape! A cross platform script language! Mainly used in web environment! Run programs on browsers (HTML
More informationE ECMAScript, 21 elements collection, HTML, 30 31, 31. Index 161
A element, 108 accessing objects within HTML, using JavaScript, 27 28, 28 activatediv()/deactivatediv(), 114 115, 115 ActiveXObject, AJAX and, 132, 140 adding information to page dynamically, 30, 30,
More informationEECS1012. Net-centric Introduction to Computing. Crash Course on PHP
EECS 1012 EECS1012 Net-centric Introduction to Computing Crash Course on PHP Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and V. Kirst.
More informationJavascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010
Lecture 14 Javascript Announcements Project #2 New website Exam#2 No. Class Date Subject and Handout(s) 17 11/4/10 Examination Review Practice Exam PDF 18 11/9/10 Search, Safety, Security Slides PDF UMass
More informationComp 426 Midterm Fall 2013
Comp 426 Midterm Fall 2013 I have not given nor received any unauthorized assistance in the course of completing this examination. Name: PID: This is a closed book exam. This page left intentionally blank.
More informationCSc 337 LECTURE 15: REVIEW
CSc 337 LECTURE 15: REVIEW HTML and CSS Tracing Draw a picture of how the following HTML/CSS code will look when the browser renders it on-screen. Assume that the HTML is wrapped in a valid full page with
More informationwelcome to BOILERCAMP HOW TO WEB DEV
welcome to BOILERCAMP HOW TO WEB DEV Introduction / Project Overview The Plan Personal Website/Blog Schedule Introduction / Project Overview HTML / CSS Client-side JavaScript Lunch Node.js / Express.js
More informationManju Muralidharan Priya. CS4PM Web Aesthetics and Development WEEK 11
CS4PM Web Aesthetics and Development WEEK 11 Objective: Understand basics of JScript Outline: a. Basics of JScript Reading: Refer to w3schools websites and use the TRY IT YOURSELF editor and play with
More informationCS Final Exam Review Suggestions - Spring 2018
CS 328 - Final Exam Review Suggestions p. 1 CS 328 - Final Exam Review Suggestions - Spring 2018 last modified: 2018-05-03 Based on suggestions from Prof. Deb Pires from UCLA: Because of the research-supported
More informationWhat is Java Script? Writing to The HTML Document. What Can JavaScript do? CMPT 165: Java Script
What is Java Script? CMPT 165: Java Script Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University November 7, 2011 JavaScript was designed to add interactivity to HTML pages
More informationJAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 2 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) AGENDA
More informationCOMP519 Web Programming Lecture 3: HTML (HTLM5 Elements: Part 1) Handouts
COMP519 Web Programming Lecture 3: HTML (HTLM5 Elements: Part 1) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of
More informationPHP: The Basics CISC 282. October 18, Approach Thus Far
PHP: The Basics CISC 282 October 18, 2017 Approach Thus Far User requests a webpage (.html) Server finds the file(s) and transmits the information Browser receives the information and displays it HTML,
More informationThen there are methods ; each method describes an action that can be done to (or with) the object.
When the browser loads a page, it stores it in an electronic form that programmers can then access through something known as an interface. The interface is a little like a predefined set of questions
More informationProgramming language components
Programming language components syntax: grammar rules for defining legal statements what's grammatically legal? how are things built up from smaller things? semantics: what things mean what do they compute?
More informationThe first sample. What is JavaScript?
Java Script Introduction JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer, Firefox, Chrome, Opera, and Safari. In this lecture
More informationWebinar. The Lighthouse Studio Scripting Series. JavaScript Sawtooth Software, Inc.
The Lighthouse Studio Scripting Series JavaScript 2 HTML 3 CSS 4 JavaScript 5 jquery (enhanced JavaScript) 6 Perl 7 HTML (Hyper Text Markup Language) 8 HTML 9 What is HTML? HTML is the language for creating
More informationProject 3 Web Security Part 1. Outline
Project 3 Web Security Part 1 CS155 Indrajit Indy Khare Outline Quick Overview of the Technologies HTML (and a bit of CSS) Javascript PHP Assignment Assignment Overview Example Attack 1 New to web programming?
More informationPIC 40A. Midterm 1 Review
PIC 40A Midterm 1 Review XHTML and HTML5 Know the structure of an XHTML/HTML5 document (head, body) and what goes in each section. Understand meta tags and be able to give an example of a meta tags. Know
More informationThis course is designed for web developers that want to learn HTML5, CSS3, JavaScript and jquery.
HTML5/CSS3/JavaScript Programming Course Summary Description This class is designed for students that have experience with basic HTML concepts that wish to learn about HTML Version 5, Cascading Style Sheets
More informationWeb Development & Design Foundations with HTML5
1 Web Development & Design Foundations with HTML5 CHAPTER 14 A BRIEF LOOK AT JAVASCRIPT Copyright Terry Felke-Morris 2 Learning Outcomes In this chapter, you will learn how to: Describe common uses of
More informationIndex. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148
Index Numbers & Symbols (angle brackets), in HTML, 47 : (colon), in CSS, 96 {} (curly brackets), in CSS, 75, 96. (dot), in CSS, 89, 102 # (hash mark), in CSS, 87 88, 99 % (percent) font size, in CSS,
More informationINTRODUCTION TO WEB DEVELOPMENT AND HTML. Lecture 13: Intro to JavaScript - Spring 2011
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 13: Intro to JavaScript - Spring 2011 Outline Intro to JavaScript What is JavaScript? JavaScript!= Java Intro to JavaScript JavaScript is a lightweight
More informationJavaScript!= Java. Intro to JavaScript. What is JavaScript? Intro to JavaScript 4/17/2013 INTRODUCTION TO WEB DEVELOPMENT AND HTML
INTRODUCTION TO WEB DEVELOPMENT AND HTML Intro to JavaScript Lecture 13: Intro to JavaScript - Spring 2013 What is JavaScript? JavaScript!= Java Intro to JavaScript JavaScript is a lightweight programming
More informationJavaScript s role on the Web
Chris Panayiotou JavaScript s role on the Web JavaScript Programming Language Developed by Netscape for use in Navigator Web Browsers Purpose make web pages (documents) more dynamic and interactive Change
More informationINSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad
INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad - 500 043 INFORMATION TECHNOLOGY TUTORIAL QUESTION BANK Course Name Course Code Class Branch : Web Technologies : ACS006 : B. Tech
More informationJavascript Lecture 23
Javascript Lecture 23 Robb T. Koether Hampden-Sydney College Mar 9, 2012 Robb T. Koether (Hampden-Sydney College) JavascriptLecture 23 Mar 9, 2012 1 / 23 1 Javascript 2 The Document Object Model (DOM)
More informationChapter 1 Getting Started with HTML 5 1. Chapter 2 Introduction to New Elements in HTML 5 21
Table of Contents Chapter 1 Getting Started with HTML 5 1 Introduction to HTML 5... 2 New API... 2 New Structure... 3 New Markup Elements and Attributes... 3 New Form Elements and Attributes... 4 Geolocation...
More informationJavaScript is described in detail in many books on the subject, and there is excellent tutorial material at
JavaScript (last updated April 15, 2013: LSS) JavaScript is a scripting language, specifically for use on web pages. It runs within the browser (that is to say, it is a client- side scripting language),
More informationJavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK
Programming for Digital Media EE1707 JavaScript By: A. Mousavi & P. Broomhead SERG, School of Engineering Design, Brunel University, UK 1 References and Sources 1. Javascript & JQuery: interactive front-end
More informationJavascript. UNIVERSITY OF MASSACHUSETTS AMHERST CMPSCI 120 Fall 2010
Lecture 22 Javascript Announcements Homework#7 now due 11/24 at noon Reminder: beginning with Homework #7, Javascript assignments must be submitted using a format described in an attachment to HW#7 I will
More informationJQuery and Javascript
JQuery and Javascript Javascript - a programming language to perform calculations/ manipulate HTML and CSS/ make a web page interactive JQuery - a javascript framework to help manipulate HTML and CSS JQuery
More information3 The Building Blocks: Data Types, Literals, and Variables
chapter 3 The Building Blocks: Data Types, Literals, and Variables 3.1 Data Types A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating
More informationCOPYRIGHTED MATERIAL. Contents. Chapter 1: Creating Structured Documents 1
59313ftoc.qxd:WroxPro 3/22/08 2:31 PM Page xi Introduction xxiii Chapter 1: Creating Structured Documents 1 A Web of Structured Documents 1 Introducing XHTML 2 Core Elements and Attributes 9 The
More information(Refer Slide Time: 01:40)
Internet Technology Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture No #25 Javascript Part I Today will be talking about a language
More informationJavaScript Programming
JavaScript Programming Course ISI-1337B - 5 Days - Instructor-led, Hands on Introduction Today, JavaScript is used in almost 90% of all websites, including the most heavilytrafficked sites like Google,
More information