JAVASCRIPT HOW TO PROGRAM -2 DR. JOHN P. ABRAHAM UTPA.

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

Web forms and CGI scripts Dr. Andrew C.R. Martin
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
24-Aug-14 HTML Forms. 2 What are forms? is just another kind of HTML tag HTML forms are used to create (rather primitive) GUIs on Web pages Usually the.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Tutorial 6 Creating a Web Form
Server-Side vs. Client-Side Scripting Languages
Session 6 Server-side programming - ASP. An ASP page is an HTML page interspersed with server-side code. The.ASP extension instead of.HTM denotes server-side.
JavaScript Forms Form Validation Cookies CGI Programs.
Creating Web Page Forms. Objectives Describe how Web forms can interact with a server-based program Insert a form into a Web page Create and format a.
Tutorial 6 Working with Web Forms
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
Creating Web Page Forms
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
CST JavaScript Validating Form Data with JavaScript.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
NETWORK CENTRIC COMPUTING (With included EMBEDDED SYSTEMS)
MS3304: Week 4 PHP & HTML Forms. Overview HTML Forms elements refresher Sending data to a script via an HTML form –The post vs. get methods –Name value.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
XP Tutorial 6New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Creating Web Page Forms Designing a Product Registration Form Tutorial.
XP Tutorial 6New Perspectives on HTML and XHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Languages in WEB Presented by: Jenisha Kshatriya BCM SS09.
Introduction to JavaScript Dr. John P. Abraham University of Texas – Pan American.
1 Forms A form is the usual way that information is gotten from a browser to a server –HTML has tags to create a collection of objects that implement this.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
Project Four Forms Discuss form processing Describe the difference between client-side and server-side form processing Add a horizontal rule to a Web page.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
1 Week Three: Using Scripts and Forms in HTML (Week Three) By Dr Fadi Safieddine.
HTML II. Factors to consider in designing a website. Organizing your files. HTML Tables. Unordered Lists. Ordered Lists. HTML Forms. Learning Objectives.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
Introduction to Programming the WWW I CMSC Summer 2004 Lecture 6.
1 Accelerated Web Development Course JavaScript and Client side programming Day 2 Rich Roth On The Net
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.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
Website Development with PHP and MySQL Saving Data.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
CSC 2720 Building Web Applications Server-side Scripting with PHP.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
HTLM Forms CS3505. Form Handling in Browser html User Files out form WEbBROWSErWEbBROWSEr User read response submit Get URL?input html Get file html script.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
 Previous lessons have focused on client-side scripts  Programs embedded in the page’s HTML code  Can also execute scripts on the server  Server-side.
 2001 Prentice Hall, Inc. All rights reserved. Chapter 7 - Introduction to Common Gateway Interface (CGI) Outline 7.1Introduction 7.2A Simple HTTP Transaction.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Form Processing Week Four. Form Processing Concepts The principal tool used to process Web forms stored on UNIX servers is a CGI (Common Gateway Interface)
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
HTML Forms. A form is simply an area that can contain form fields. Form fields are objects that allow the visitor to enter information - for example text.
PHP Form Processing * referenced from
HTML Structure II (Form) WEEK 2.2. Contents Table Form.
FORMS Explained By: Jasdeep Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
1 CGI (Common Gateway Interface) CmpE 587 Emir Bayraktar Onur Bük.
University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Introduction to Web Technologies.
Ashima Wadhwa Java Script And Forms. Introduction Forms: –One of the most common Web page elements used with JavaScript –Typical forms you may encounter.
XP Tutorial 6New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
Tutorial 6 Working with Web Forms
Introduction to Dynamic Web Programming
Section 17.1 Section 17.2 Add an audio file using HTML
JAVASCRIPT HOW TO PROGRAM -2
Presentation transcript:

JAVASCRIPT HOW TO PROGRAM -2 DR. JOHN P. ABRAHAM UTPA

Script development process Requirement analysis Goal – Audience Design Sketch the page – Site map – outline content - pseudocode Implementation Coding Support & maintenance

Script statements in head User defined functions Global variables Statements that preload images for use in rollover effects

Keep an HTML outline Array example

InputBox Ask user name var visitor = prompt("What is your name?", " ")

Using input Ask user name var visitor = prompt("What is your name?", “Default Name ") document.write(" Hello, ", visitor, "! ")

Onload (event) Ask user name var visitor = prompt("What is your name?", " ")

Alert Box with 2 lines Ask user name var visitor = prompt("What is your name?", " ")

Function with return value function product(a,b) { return a*b; } document.write(product(4,3)); The script in the body section calls a function with two parameters (4 and 3). The function will return the product of these two parameters.

Looping Nested Loop var i=1, j; while (i <= 12) {document.writeln(" Table for ",i, " "); for (j=1; j <=16; j++) document.writeln(i, " x ", j, " = ", i*j," "); i++ }

Table table is divided into rows (with the tag), each row is divided into data cells (with the tag). td stands for "table data," and holds the content of a data cell. A tag can contain text, links, images, lists, forms, other tables, etc.

Looping & Table Nested Loop var i=1, j; while (i <= 12) {document.writeln(" "); document.writeln(" Table for ",i, " "); for (j=1; j <=16; j++) document.writeln(" ",i, " x ", j, " = ", i*j," "); document.writeln(" "); i++ }

Assignment Help Future value of an investment var age, initial, deposit, rate; getdata(); if (rate >1) rate = rate/100; //convert rate to fraction just in case. document.writeln( age," ", initial," ", deposit," ", rate); function getdata() { document.writeln(" This program calculates your total assets at retirment (age 65)"); document.writeln(" given initial deposit, amount of deposit every 30 days, "); document.writeln(" interest rate and your current age."); document.writeln(" data entry "); age=parseInt(window.prompt("How old are you (must be below 65)? > ")); initial=parseFloat(window.prompt( "What is your initial deposit? > ")); deposit=parseFloat(window.prompt( "Amount you agree to deposit every 30 days? > ")); rate=parseFloat(window.prompt( "What would be your expectation of interest or growth? ")); return initial, deposit, rate, age; }

JavaScript Arrays Dr. John P. Abraham Professor UTPA

Declaring & populating an Array var students = new array() students[0] = “Harry” students[2]= “Jim” var months= new Array(“Jan”,”Feb”…”Dec”) --display— For (i=0; I ’)

Stack Operations var stack = new Array(); function createStack(top) {top = 0; } function destroyStack(top) {top = 0; } function emptyStack(top ) { return (top = 0); } function push(element) {top = top + 1; stack[top] = element; } function pop() {element = stack[top]; top = top - 1; return element; }

Parsing a String probLen = problem.length; while (j <= probLen-1) { onechar = problem.charAt(j); while ((onechar !=" ") && (j <=probLen-1)) { parse(); j++; onechar = problem.charAt(j); }//while inner if (nums != "") pushStack() else if (opcode != "") domath(); j++; }//while outer

Function parse function parse() { if (onechar >= "." && onechar <= "9") {if (onechar != "/") nums = nums + onechar; else opcode = onechar; } else opcode = onechar; }

Forms and Form Processing (CGI) Dr. John P. Abraham UTPA

Purpose of forms Collect information for the users (user input collection) Sent from browsers (clients) to servers

Sample form Name: Password: Male Female

What is a form Form element of HTML Designed to collect input Mail to vs. server-side scripts mailto URL causes the form data to sent to an address. No server-side scripting is required. Server-side scripts. CGI, Perl, PHP, ASP, ColdFusion. Can write the data to a database.

Post vs. Get Post method – form data is sent separately from the actual call to the server-side script. (data is sent under separate cover) Preferred method Get method: the data is appended to the end of the URL that calls a server- side script. Easy to see what is being sent.

Input types Text Selections – radio buttons Check boxes Pull-down menus (pick one for State) Hidden input elements (such as session info)

Introduction to CGI Data sent to server require customized processing on the server side. Common Gateway Interface governs the way a web-server (Apache, IIS, etc.) interacts with an external program. A popular scripting language conforms to CGI is PERL. CGI programs can be written any language.

Browsers and CGI End user clicks the submit button Form’s data are sent over the internet to the web server. Web server upon receipt of the requests executes the correct application program Forwards the input data to that program The application program performs requested steps. Generates output back to the server in HTML Web server forwards the output to the client Client browser displays it

Outline of a CGI program Determines request method (get or post) and receives input data. Decodes and checks input data. Performs tasks Produces output in HTML format

Perl programming language Practical Extension and Reporting Language 1987 Larry Wall at NASA Free Provides a CGI interface module Portable application (runs on web servers on different platforms)

CGI-tutorial html

Example of a CGI program #!/usr/bin/perl print "Content-type: text/html\n\n"; print " Hello World \n"; print " \n"; print " Hello, world! \n"; print " \n";

HTML5 It is time for you (and me) to learn HTML5 I suggest you go to this site and follow the tutorial.