Lecture 9: Events and timers

Slides:



Advertisements
Similar presentations
Table, List, Blocks, Inline Style
Advertisements

Tutorial 6 Creating a Web Form
1 Introduction to HTML II อุทัย เซี่ยงเจ็น สำนักวิชาเทคโนโลยีสารสนเทศ และการสื่อสาร มหาวิทยาลัยนเรศวร พะเยา.
Images, Tables, lists, blocks, layout, forms, iframes
Chapter 6 Basic forms 1. Forms and query string 2 form : a group of user input (UI) controls that accepts information from the user and sends the information.
SE-2840 Dr. Mark L. Hornick 1 HTML input elements and forms.
17/10/11. 2  The form element ( ) is used to include a number of form elements together so that they can be referenced by some other code in order to.
Form Basics CS Web Data  Most interesting web pages revolve around data  examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes  can.
User Interface Design using jQuery Mobile CIS 136 Building Mobile Apps 1.
More Event-Driven Programming Chapter Exercise Make a button whose label toggles between "on" and "off".
Forms, Validation Week 7 INFM 603. Announcements Try placing today’s example in htdocs (XAMPP). This will allow you to execute examples that rely on PHP.
CSE 154 LECTURE 9: FORMS. Web data most interesting web pages revolve around data examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes can.
Tutorial #9 – Creating Forms. Tutorial #8 Review – Tables Borders (table, gridlines), Border-collapse: collapse; empty-cells: show; and rowspan, colspan.
Suzanne J. Sultan Javascript Lecture 2. Suzanne J. Sultan function What is a function> Types of functions:  Function with no parameters  Function with.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
INTRODUCTORY Tutorial 8 Creating Forms. XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Create an HTML form Create fields for text Create.
© 2010 Delmar, Cengage Learning Chapter 8 Collecting Data with Forms.
CSE 154 LECTURE 18: THE DOCUMENT OBJECT MODEL (DOM); UNOBTRUSIVE JAVASCRIPT.
HTML Forms. Slide 2 Forms (Introduction) The purpose of input forms Organizing forms with a and Using different element types to get user input A brief.
© 2011 Delmar, Cengage Learning Chapter 3 Working with Text and Cascading Style Sheets.
HTML Forms a form is a container for input elements on a web page input elements contain data that is sent to the web server for processing.
Web Forms. Survey or poll Contact us Sign up for an newsletter Register for an event Submit comments or feedback about our site Log in to a members-only.
SYST Web Technologies SYST Web Technologies XHTML Forms.
+ FORMS HTML forms are used to pass data to a server. begins and ends a form Forms are made up of input elements Every input element has a name and value.
HTML Forms.
Lecture 8: Events and timers
20-753: Fundamentals of Web Programming 1 Lecture 6: Advanced HTML Fundamentals of Web Programming Lecture 6: Advanced HTML.
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Project 6: Creating XHTML Forms Kelly.
USABLEANDACCESSIBLEFORMS. accessibility or Accessibility?
03 – HTML (2) Informatics Department Parahyangan Catholic University.
CSE 154 LECTURE 7: THE DOCUMENT OBJECT MODEL (DOM); UNOBTRUSIVE JAVASCRIPT.
Tutorial 6 Creating a Web Form
Web Forms. Web Forms: A form allows our web visitors to submit information to us. Some examples uses for forms are to let the web user contact us, fill.
HTML FORM. Form HTML Forms are used to select different kinds of user input. HTML forms are used to pass data to a server. A form can contain input elements.
Lesson 5 Introduction to HTML Forms. Lesson 5 Forms A form is an area that can contain form elements. Form elements are elements that allow the user to.
HTML Tables Tables are defined with the tag. A table is divided into rows (with the tag), and each row is divided into data cells (with the tag). td stands.
FORMS Explained By: Jasdeep Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
XHTML Forms.
Tutorial 6 Working with Web Forms
Creating and Processing Web Forms
Web Development Part 2.
Web Forms.
Web Forms.
>> Introduction to CSS
Objectives Design a form Create a form Create text fields
CS3220 Web and Internet Programming HTML Tables and Forms
HTML Forms Pat Morin COMP 2405.
ASP.NET Web Controls.
>> More on HTML Forms
(and available form fields)
ITE 115 Creating Web Page Forms
Server-Side Application and Data Management IT IS 3105 (Spring 2010)
HTML Forms CSC 102 Lecture.
Intro to CSS CS 1150 Fall 2016.
HTML/XHTML Forms 18-Sep-18.
Introducing Forms.
Objectives Explore web forms Work with form servers
Intro to CSS CS 1150 Spring 2017.
>> Dynamic CSS Selectors
CNIT 131 HTML5 - Forms.
CS3220 Web and Internet Programming HTML Tables and Forms
Lecture 9: TIMERS and The DoM tree
Lecture 7: Unobtrusive JavaScript
The Internet 10/27/11 XHTML Forms
CMPT241 Web Programming Chapter 6 Forms.
Working with ‘checked’ items Checkboxes and Radio buttons
Lecture 8: Events and timers
Lecture 7: Unobtrusive JavaScript
Web Forms.
Presentation transcript:

Lecture 9: Events and timers CSE 154 Lecture 9: Events and timers

Checkboxes: <input> yes/no choices that can be checked and unchecked (inline) <input type="checkbox" name="lettuce" /> Lettuce <input type="checkbox" name="tomato" checked="checked" /> Tomato <input type="checkbox" name="pickles" checked="checked" /> Pickles HTML output none, 1, or many checkboxes can be checked at same time when sent to server, any checked boxes will be sent with value on: http://webster.cs.washington.edu/params.php?tomato=on&pickles=on use checked="checked" attribute in HTML to initially check the box

Radio buttons: <input> sets of mutually exclusive choices (inline) <input type="radio" name="cc" value="visa" checked="checked" /> Visa <input type="radio" name="cc" value="mastercard" /> MasterCard <input type="radio" name="cc" value="amex" /> American Express HTML output grouped by name attribute (only one can be checked at a time) must specify a value for each one or else it will be sent as value on

Text labels: <label> <label><input type="radio" name="cc" value="visa" checked="checked" /> Visa</label> <label><input type="radio" name="cc" value="mastercard" /> MasterCard</label> <label><input type="radio" name="cc" value="amex" /> American Express</label> HTML output associates nearby text with control, so you can click text to activate control can be used with checkboxes or radio buttons label element can be targeted by CSS style rules

Drop-down list: <select>, <option> menus of choices that collapse and expand (inline) <select name="favoritecharacter"> <option>Jerry</option> <option>George</option> <option selected="selected">Kramer</option> <option>Elaine</option> </select> HTML output option element represents each choice select optional attributes: disabled, multiple, size optional selected attribute sets which one is initially chosen

Using <select> for lists <select name="favoritecharacter[]" size="3" multiple="multiple"> <option>Jerry</option> <option>George</option> <option>Kramer</option> <option>Elaine</option> <option selected="selected">Newman</option> </select> HTML output optional multiple attribute allows selecting multiple items with shift- or ctrl-click must declare parameter's name with [] if you allow multiple selections option tags can be set to be initially selected

Option groups: <optgroup> <select name="favoritecharacter"> <optgroup label="Major Characters"> <option>Jerry</option> <option>George</option> <option>Kramer</option> <option>Elaine</option> </optgroup> <optgroup label="Minor Characters"> <option>Newman</option> <option>Susan</option> </select> HTML output What should we do if we don't like the bold appearance of the optgroups?

Grouping input: <fieldset>, <legend> groups of input fields with optional caption (block) <fieldset> <legend>Credit cards:</legend> <input type="radio" name="cc" value="visa" checked="checked" /> Visa <input type="radio" name="cc" value="mastercard" /> MasterCard <input type="radio" name="cc" value="amex" /> American Express </fieldset> HTML output fieldset groups related input fields, adds a border; legend supplies a caption

Styling form controls element[attribute="value"] { property : value; ... } CSS input[type="text"] { background-color: yellow; font-weight: bold; } CSS output attribute selector: matches only elements that have a particular attribute value useful for controls because many share the same element (input)

The innerHTML property <button onclick="addText();">Click me!</button> <span id="output">Hello </span> HTML function addText() { var span = document.getElementById("output"); span.innerHTML += " bro"; } JS output can change the text inside most elements by setting the innerHTML property

Abuse of innerHTML // bad style! var paragraph = document.getElementById("welcome"); paragraph.innerHTML = "<p>text and <a href=\"page.html\">link</a>"; JS innerHTML can inject arbitrary HTML content into the page however, this is prone to bugs and errors and is considered poor style we forbid using innerHTML to inject HTML tags; inject plain text only (later, we'll see a better way to inject content with HTML tags in it)