JavaScript, Third Edition 1 SELECTION LIST Demo. JavaScript, Third Edition 2 Description This web page will edit the slection to ensure an option was.

Slides:



Advertisements
Similar presentations
17 HTML, Scripting, and Interactivity Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and.
Advertisements

Dreamweaver Forms Overview. Forms – A Little Review Most user/webpage communication is one way, like this: Most user/webpage communication is one way,
MWD1001 Website Production Using JavaScript with Forms.
The Web Warrior Guide to Web Design Technologies
HTML Recall that HTML is static in that it describes how a page is to be displayed, but it doesn’t provide for interaction or animation. A page created.
Computer Science 103 Chapter 4 Advanced JavaScript.
Web Development & Design Foundations with XHTML Chapter 14 Key Concepts.
Inline, Internal, and External FIle
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
Introduction to JavaScript Form Verification - Fort Collins, CO Copyright © XTR Systems, LLC Verifying Submitted Form Data with JavaScript Instructor:
Lesson 8 Creating Forms with JavaScript
CST JavaScript Validating Form Data with JavaScript.
Javascript and the Web Whys and Hows of Javascript.
Department of Information Technology e-Michigan Web Development 0 HTML Form Creation in the Vignette Content Management Application.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Event and Event Handling.
Chapter 3 Using Validation Controls. What is a Validation Control? A control that validates the value in another control Renders as an HTML tag with an.
Web engineering. Topic: DHTML Presented by: Shah Rukh Presented to: Sir Ahsan raza.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
IT – som værktøj Bent Thomsen Institut for Datalogi Aalborg Universitet.
Execution Environment for JavaScript " Java Script Window object represents the window in which the browser displays documents. " The Window object provides.
JavaScript Part 1.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
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.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 3.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
G053 - Lecture 16 Validating Forms Mr C Johnston ICT Teacher
Faculty of Sciences and Social Sciences HOPE JavaScript Advanced Stewart Blakeway FML
Using Client-Side Scripts to Enhance Web Applications 1.
Introduction to JavaScript 41 Introduction to Programming the WWW I CMSC Winter 2004 Lecture 17.
CO1552 Web Application Development HTML Forms, Events and an introduction to JavaScript.
Client-Side Scripting JavaScript.  produced by Netscape for use within HTML Web pages.  built into all the major modern browsers. properties  lightweight,
JavaScript, jQuery, and Mashups Incorporating JavaScript, jQuery, and other Mashups into existing pages.
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.
Input & Output Functions JavaScript is special from other languages because it can accept input and produce output on the basis of that input in the same.
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
An Introduction to JavaScript By: John Coliton Tuesday, November 10, 1998 Center for Teaching and Learning.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 8 Scott Marino.
Event JavaScript's interaction with HTML is handled through events that occur when the user or browser manipulates a page. When the page loads, that is.
Dialog boxes in JavaScript Events in JavaScript – What are they – “Which events are there?” – “How do I register event handlers to an HTML element?” –
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
JavaScript, Fourth Edition
JavaScript Introduction.  JavaScript is a scripting language  A scripting language is a lightweight programming language  A JavaScript can be inserted.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
Unit 10 – JavaScript Validation Instructor: Brent Presley.
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.
Event Handling. Objectives Using event handlers Simulating events Using event-related methods.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Understanding JavaScript and Coding Essentials Lesson 8.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Chapter 4 Murach's JavaScript and jQuery, C4© 2012, Mike Murach & Associates, Inc.Slide 1.
Chapter 5: Intro to Scripting CIS 275—Web Application Development for Business I.
Check Boxes. 2 Check boxes  Image from:  HTML:  Each box gets it's own.
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.
Chapter 10 Dynamic HTML (DHTML) JavaScript, Third Edition.
Java Script Programming. Review: Event Handling Text Box Title: Button.
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
CNIT 133 Interactive Web Pags – JavaScript and AJAX Popup Boxes.
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
Third lecture Event 27/2/2016 JavaScript Tutorial.
Build in Objects In JavaScript, almost "everything" is an object.
Web Development & Design Foundations with HTML5
Intro to JavaScript CS 1150 Spring 2017.
JavaScript (JS) Basics
Section 17.1 Section 17.2 Add an audio file using HTML
Events Comp 205 Fall 2017.
Conditionally Confirming a Submit
Events: Changed and Input
Presentation transcript:

JavaScript, Third Edition 1 SELECTION LIST Demo

JavaScript, Third Edition 2 Description This web page will edit the slection to ensure an option was chosen. If not, the an alert box will be displayed, otherwise the form will be submitted. This demo shows the following: –The proper coding of the tag –The proper coding of the formfield (in this case, the button) –The capturing of the submit buttons click event –The definition of a function –The execution of the function

JavaScript, Third Edition 3 <!-- HTML COMMENT WILL HIDE FROM INCOMPATIBLE BROWSERS function editFormData() { } // STOP HIDING FROM INCOMPATIBLE BROWSERS --> Create the structural code for the function inside the script tag. Name the function :

JavaScript, Third Edition 4 function editFormData() { if (document.forms[0].lstPet.selectedIndex < 1) { window.alert("Please check which pet you would like to have!") return false; } else { if (document.forms[0].lstPet.options[1].selected == true) { window.alert ("You have a dog!"); return true; } else { window.alert ("You have a cat!"); return true; } The logic in the function to verify a selection was made

JavaScript, Third Edition 5 <!-- HTML COMMENT WILL HIDE FROM INCOMPATIBLE BROWSERS function editFormData () { ….. // STOP HIDING FROM INCOMPATIBLE BROWSERS --> Add an HTML form tag pair the web page.

JavaScript, Third Edition 6 <!-- HTML COMMENT WILL HIDE FROM INCOMPATIBLE BROWSERS function editFormData () { … } // STOP HIDING FROM INCOMPATIBLE BROWSERS --> Pick your pet Select a Pet Dog Cat Add an HTML SUBMIT button to the web page. When its onclick event occurs, execute the function editFormData()

JavaScript, Third Edition 7 How it works… From formProcessor.html when form is submitted If cat selected If dog selected

JavaScript, Third Edition 8 CODE Select function editFormData() { if (document.forms[0].lstPet.selectedIndex == 0) { alert("Please check which pet you have or would like to have!") return false; } else { if (document.forms[0].lstPet.options[1].selected == true) { alert ("You have a dog!"); return true; } else { alert ("You have a cat!"); return true; } CONTINUED ON NEXT SLIDE

JavaScript, Third Edition 9 CODE Editing a Select Pick your pet Select a Pet Dog Cat