Lecture # 10 JavaScript Programming II. Today Questions: From notes/reading/life? Review Homework # 2 1.Introduce: How make widgets work with JavaScript?

Slides:



Advertisements
Similar presentations
Lecture # 9 JavaScript Programming I. Today Questions: From notes/reading/life? Spreadsheet Review Preview Lab # 4 1.Introduce: How can I write a program.
Advertisements

JavaScript Forms Form Validation Cookies. What JavaScript can do  Control document appearance and content  Control the browser  Interact with user.
Forms cs105. More Interactive web-pages So far what we have seen was to present the information. (Ex: tables. Lists,….). But it is not enough. We want.
Chapter 7 © 2001 by Addison Wesley Longman, Inc. 1 Chapter 7 Sebesta: Programming the World Wide Web.
JavaScript Forms Form Validation Cookies CGI Programs.
20-Jun-15 JavaScript and HTML Simple Event Handling.
Information Technology Center Hany Abdelwahab Computer Specialist.
Lesson 8 Creating Forms with JavaScript
1 CS101 Introduction to Computing Lecture 32 Event Handling (Web Development Lecture 11)
JavaScript Form Validation
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 07: Forms - Spring 2011.
JS: DOM Form Form Object Form Object –The Form object represents an HTML form. –For each instance of a tag in an HTML document, a Form object is created.
HTML Forms/Events (Instructor Lesson) The Event model HTML Forms Custom Events 1.
JavaScript - Document Object Model. Bhawna Mallick 2 Unit Plan What is DOM and its use? Hierarchy of DOM objects. Reflection of these objects in an HTML.
Introduction to JavaScript. JavaScript Facts A scripting language - not compiled but interpreted line by line at run-time. Platform independent. It is.
Event-driven Programming
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
Chapter 5 © 2003 by Addison-Wesley, Inc. 1 Chapter 5 JavaScript and HTML Documents.
Copyright ©2005  Department of Computer & Information Science Introducing DHTML & DOM: JavaScript & Forms.
JavaScript II ECT 270 Robin Burke. Outline JavaScript review Processing Syntax Events and event handling Form validation.
Chapter 5 JavaScript and HTML Documents. © 2006 Pearson Addison-Wesley. All rights reserved JavaScript Execution Environment - The JavaScript.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 JavaScript and HTML Documents.
JavaScript Part 1.
CS346 Javascript-7A Events1 DOM Document Object Model and Events.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
CSS Class 7 Add JavaScript to your page Add event handlers Validate a form Open a new window Hide and show elements Swap images Debug JavaScript.
Lecture # 6 Forms, Widgets and Event Handling. Today Questions: From notes/reading/life? Share Personal Web Page (if not too personal) 1.Introduce: How.
Using Client-Side Scripts to Enhance Web Applications 1.
CO1552 Web Application Development HTML Forms, Events and an introduction to JavaScript.
Chapter 5 © 2005 by Addison Wesley Longman, Inc JavaScript Execution Environment - The JavaScript Window object represents the window in which the.
Lecture 10 JavaScript: DOM and Dynamic HTML Boriana Koleva Room: C54
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 8 Scott Marino.
Lecture # 13 JavaScript Functions: A Trip to the Grocery Store.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
Forms Collecting Data CSS Class 5. Forms Create a form Add text box Add labels Add check boxes and radio buttons Build a drop-down list Group drop-down.
Client-Side programming with JavaScript 2. Event-driven programs and HTML form elements event-driven programs  onload, onunload  HTML forms & attributes.
Chapter 19 Creating and Processing HTML Forms. How HTML Forms Transmit Data name1=value1&name2=value2...&nameN =valueN GET or POST GET, an HTTP GET request,
Jaana Holvikivi 1 Introduction to Javascript Jaana Holvikivi Metropolia.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
Event Handling. Objectives Using event handlers Simulating events Using event-related methods.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Variables, Functions and Events (NON-Audio version) © Dr. David C. Gibbs WDMD.
HTML FORMS The TEXT Object Presented By: Ankit Gupta.
Unit 2 — The Exciting World of JavaScript Lesson 7 — Creating Forms with JavaScript.
HTML Form Inputs. Creating a basic form …content goes here…
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
Dr. Ahmet Cengizhan Dirican BIL 374 Internet Technologies 5. JavaScript and HTML Documents.
JavaScript II ECT 270 Robin Burke. Outline Functions Events and event handling Form validation.
JavaScript Event Handlers. Introduction An event handler executes a segment of a code based on certain events occurring within the application, such as.
Event Handlers Events are asynchronous. When an event occurs, JavaScript can execute code in response to the user’s action. This response to the user-initiated.
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 Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
Lecture # 7 Spreadsheet Basics. I have two coins in my hand that total 55¢. One is not a nickel. What are the two coins?
Lecture # 12 JavaScript Functions and Debugging. Today Questions: Quiz 1? Review for Quiz 2. 1.Introduce: How can you make an On-line Grocery List? 2.Explain:
JavaScript, Third Edition 1 SELECTION LIST Demo. JavaScript, Third Edition 2 Description This web page will edit the slection to ensure an option was.
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
Chapter 14 The HTML Tag
XHTML Forms.
HTML Again GUI Items Originally HTML 4 Copyright © Curt Hill.
JavaScript and HTML Simple Event Handling 11-May-18.
In this session, you will learn to:
JAVASCRIPTS AND HTML DOCUMENTS
Web Programming– UFCFB Lecture 17
JavaScript and HTML Simple Event Handling 19-Sep-18.
Creating Form Elements
Creating Form Elements
JavaScript and Forms Kevin Harville.
JavaScript and Ajax (JavaScript Events)
JavaScript and HTML Simple Event Handling 26-Aug-19.
JavaScript and HTML Simple Event Handling 4-Oct-19.
Presentation transcript:

Lecture # 10 JavaScript Programming II

Today Questions: From notes/reading/life? Review Homework # 2 1.Introduce: How make widgets work with JavaScript? 2.Explain: Text Concatenation, Referring to Widgets, Document Trees, More Forms, Demos 3.Demo: JavaScript Magic – follow along on laptop 4.Practice: You solve a problem with a JavaScript 5.Evaluate: Share and evaluate your solution 6.Re-practice:Write a JavaScript function to fill a text area Wrap JavaScript Functions around widgets

Today Questions: From notes/reading/life? Review Homework # 2 1.Introduce: How make widgets work with JavaScript? 2.Explain: Text Concatenation, Referring to Widgets, Document Trees, More Forms, Demos 3.Demo: JavaScript Magic – follow along on laptop 4.Practice: You solve a problem with a JavaScript 5.Evaluate: Share and evaluate your solution 6.Re-practice:Write a JavaScript function to fill a text area Wrap JavaScript Functions around widgets

Today Questions: From notes/reading/life? Review Homework # 2 1.Introduce: How make widgets work with JavaScript? 2.Explain: Text Concatenation, Referring to Widgets, Document Trees, More Forms, Demos 3.Demo: JavaScript Magic – follow along on laptop 4.Practice: You solve a problem with a JavaScript 5.Evaluate: Share and evaluate your solution 6.Re-practice:Write a JavaScript function to fill a text area Wrap JavaScript Functions around widgets

Review How to write functions Return statements If-else Calling a function you wrote when an event occurs Concatenating strings Using document.write() and alert()

What is the general algorithm for collecting text data into a string?

1.Initialize string (possibly string="")

What is the general algorithm for collecting text data into a string? 1.Initialize string (possibly string="") 2. Add/append other text to the string recursively (string=string + "more text")

How do we refer to a widget? To refer to the checkbox: document.myform.mybox (mybox[i] if >1 box) To refer to the status of the checkbox (true or false): document.myform.mybox[i].checked To refer to the value of the checkbox: document.myform.mybox[i].value

Document Trees Form One Address Should we keep it? Small Medium Large Form Two <form name=“secondForm” Pepperoni Sausage Pineapple Limburger and Onion <input type="button" name="myButton" value=“My Button">

Document Trees document firstForm secondForm addresskeepersize topping myButton valuechecked value [0] checked [1] checked [2] checked

Document Tree Path Names document firstForm secondForm addresskeepersize topping myButton valuechecked value [0] checked [1] checked [2] checked document.firstForm.address.value=“1075 North”; document.secondForm (is a form) document.secondForm.myButton (is a button) document.secondForm.myButton.value (is a string) if (document.firstForm.keeper.checked) {…} if (document.firstForm.size[2].checked) {…}

Widget Review Text Box: size, maxlength, name, value Button: value, name Check Box: checked, name Radio Buttons (array): checked, name Selection List: size, name –Each option: selected Text Area: cols, rows, name

Event Handling Predefined events –onClick –mouseOver When the event happens, we can tell a certain function to execute The Event Handler is the function you call This is called Event Handling

More Form Widget Events Button, Check Box, Radio Buttons –onclick Text Box, Text Area –onchange, onfocus, onblur, onselect Selection List –onchange, onclick, onfocus, onblur

Today Questions: From notes/reading/life? Review Homework # 2 1.Introduce: How make widgets work with JavaScript? 2.Explain: Text Concatenation, Referring to Widgets, Document Trees, More Forms, Demos 3.Demo: JavaScript Magic – follow along on laptop 4.Practice: You solve a problem with a JavaScript 5.Evaluate: Share and evaluate your solution 6.Re-practice:Write a JavaScript function to fill a text area Wrap JavaScript Functions around widgets

Payroll Demos

Text Style Demos

Today Questions: From notes/reading/life? Review Homework # 2 1.Introduce: How make widgets work with JavaScript? 2.Explain: Text Concatenation, Referring to Widgets, Document Trees, More Forms, Demos 3.Demo: JavaScript Magic – follow along on laptop 4.Practice: You solve a problem with a JavaScript 5.Evaluate: Share and evaluate your solution 6.Re-practice:Write a JavaScript function to fill a text area Wrap JavaScript Functions around widgets

Group Exercise: Check Style Change + Radio Create a form that looks like this: So that when the boxes and radio buttons are checked or set, the corresponding changes automatically appear in the text box. You have 5minutes

Group Exercise: Check Style Change Now add Radio Buttons: Program the “Set the Style” button so that when the boxes are checked, and the button is clicked, the corres- ponding text appears in the text box. You have 10 minutes

Common Bugs Spelling and capitalization (JavaScript is CaSE senSItivE) Bad punctuation (missing ; or “) Mismatched brackets, parenthesis, or quotes Forgetting () when creating or calling a function Functions should be in tags inside the header Calling a widget by its label, rather than its name