interacting with users chapter 7

76

Upload: noah-fuentes

Post on 30-Dec-2015

26 views

Category:

Documents


0 download

DESCRIPTION

Interacting With Users Chapter 7. Learn how to…. Create a Web form. Create a PayPal button. Create an image map. Create a frameset. FTP files to the Web and set file permissions. Creating HTML Forms. Creating HTML Forms. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Interacting With Users Chapter 7
Page 2: Interacting With Users Chapter 7

Interacting With Users

Chapter 7

Page 3: Interacting With Users Chapter 7

Learn how to…

• Create a Web form.

• Create a PayPal button.

• Create an image map.

• Create a frameset.

• FTP files to the Web and set file permissions.

Page 4: Interacting With Users Chapter 7

Creating HTML Forms

Page 5: Interacting With Users Chapter 7

Creating HTML Forms

• A form prompts the user to fill in one or more blanks and/or select items from a menu of possible choices.

• The <form> start and </form> stop tags mark the beginning and ending of an HTML form.

• Between these tags go the controls that prompt the user for specific information, along with any onscreen instructions you want to provide.

Page 6: Interacting With Users Chapter 7

Prompts

• A prompt is an onscreen instruction that asks the user to provide some information, either by typing a response into a text field or by choosing something from a selection of possible choices.

Page 7: Interacting With Users Chapter 7

Beginning the Form

Page 8: Interacting With Users Chapter 7

Form Tags

• Every <form> start tag has two attributes, namely, a method and an action.

Page 9: Interacting With Users Chapter 7

Text Input Controls

• Use the <input> tag to create the form controls that receive input from users.– The <input> tag has several attributes:

• The type attribute specifies the kind of control you want.

• The name attribute specifies the name of the control.

• The size attribute specifies how many characters wide on the screen.

• The maxlength attribute specifies the maximum number of characters users can type.

Page 10: Interacting With Users Chapter 7

Text Input Controls

Page 11: Interacting With Users Chapter 7

Radio Button Control

• A radio button displays a small round button that allows users to select one, but not more than one, item from a list of possible choices.

checked causes this item to be initially checked by default.

Page 12: Interacting With Users Chapter 7

Radio Button Control

• This adds additional options for the Frequency radio button control.

Page 13: Interacting With Users Chapter 7

Submit and Reset Buttons

• The Submit button is the onscreen control that users click to submit the form.– Use <input type=“Submit” value=“xxxx”>

• Xxxx is the text displayed (the default text is Submit).

• Click a Reset button to return the controls to their default settings.– Use <input type=“reset”>

Page 14: Interacting With Users Chapter 7

Submit and Reset Buttons

Page 15: Interacting With Users Chapter 7

Completed Form

Page 16: Interacting With Users Chapter 7

Processing the Response

• We used the mailto option in the form tag to have the response e-mailed.

• A more advanced method is to read the information, save the form’s data in a database, decide how to act on it, and respond appropriately to the user.– To make a form post its data to an Active

Server Page (ASP) script, type:• <form method="post"

action="http://toys.northpole.com/WishList.asp">

Page 17: Interacting With Users Chapter 7

CGI Scripting

• The art of server-side programming is known as common gateway interface (CGI) scripting.

• The POST method sends the form’s data to a CGI script.

Page 18: Interacting With Users Chapter 7

GET Method

• An HTTP GET method appends the form’s data to the URL as a query string.– Used especially at search engine sites.

Page 19: Interacting With Users Chapter 7

Form Submission

• For more info, see www.w3.org/TR/html4

Page 20: Interacting With Users Chapter 7

Check Box

• A check box presents the user with a small box that the user can click to turn an option on or off.

Page 21: Interacting With Users Chapter 7

Check Box Example

Page 22: Interacting With Users Chapter 7

Selection Menu

• Create a selection menu with the <select> start and </select> stop tags.

• Use the <option> tag to specify the menu options.

Page 23: Interacting With Users Chapter 7

Text Areas

• Text areas allow large amounts of text to be typed.– Use the <textarea> start and </textarea>

stop tags.

Page 24: Interacting With Users Chapter 7

Multiple Selection Menu

• To allow users to make multiple selections from a selection menu, include the multiple attribute with a size that indicates the number of menu options to be displayed at a time.– Users need to use Ctrl+click to select items.

<select name=" ControlName" size="10" multiple>

Page 25: Interacting With Users Chapter 7

Password Fields

• A password field is a text box that works like a text field except that when the user types the entry, the browser displays asterisks.

Page 26: Interacting With Users Chapter 7

Summary

Page 27: Interacting With Users Chapter 7

Summary

Page 28: Interacting With Users Chapter 7

Making a PayPal Buy Now Button

Page 29: Interacting With Users Chapter 7

PayPal

• PayPal is a person-to-person payment system that individuals can use to sell products.

• A PayPal button, when clicked, posts data to the PayPal server indicating what product the user wants to buy from you.

• The PayPal system handles all the rest.

Page 30: Interacting With Users Chapter 7

Hidden Fields

• A hidden field creates a variable name and a corresponding value that are not displayed onscreen but are posted along with the rest of the form’s data when the user clicks the button to submit the form.

Page 31: Interacting With Users Chapter 7

Hidden Fields

Page 32: Interacting With Users Chapter 7

Image Buttons

• An image button displays an image instead of the Submit button.

Page 33: Interacting With Users Chapter 7

PayPal Buy Now Button

• When clicked, the PayPal Buy Now button posts HTML form data to the PayPal e-commerce server.– Information about the product being

purchased.– The business that is making the sale.

• There are many options that can be present, apart from those that are always required.

Page 34: Interacting With Users Chapter 7

Creating a PayPal Button

Begin the form and identify your business:

Insert hidden fields to describe the product you are selling:

Page 35: Interacting With Users Chapter 7

Creating a PayPal Button

Give the customer an option to get an autographed copy of the book:

Display the button and finish the form tag:

Page 36: Interacting With Users Chapter 7

PayPal Variables

To view the PayPal button manual, visit https://www.paypal.com/en_US/pdf/single_item.pdf

Page 37: Interacting With Users Chapter 7

PayPal Button Factory

• PayPal has a button factory that generates automatically the HTML to paste on to your page to sell items at your Web site.– Log on to your PayPal account at

www.paypal.com and click the Merchant Tools tab. Under the Website Payments heading, follow the link to Buy Now Buttons to make the Button Factory appear.

Page 38: Interacting With Users Chapter 7

Designing HTML Image Maps

Page 39: Interacting With Users Chapter 7

Image Maps

• An image map is an invisible layer of triggers placed over an image onscreen.– The triggers can be rectangular, circular, or

polygonal.– When the user clicks inside one of the

invisible triggers, the Web browser triggers the object of the link.

Page 40: Interacting With Users Chapter 7

Map and Area Tags

• Use the <map> and </map> tags to mark the beginning and ending of the image map.

• Use the <area> tag to create the triggers.– The shape attribute defines the shape.– The coord attribute specifies the x,y coordinates of

the links relative to the top-left corner of the image at 0,0.

• coord=x1,y1,x2,y2 where x1,y1 is the top-left corner of the area and x2,y2 is the bottom-right corner of the image.

Page 41: Interacting With Users Chapter 7

Example: Web Page

Page 42: Interacting With Users Chapter 7

Example: HTML Code

Page 43: Interacting With Users Chapter 7

Visualizing the Coordinates

• Too low – 0,0,112,32

• Middle C (correct)– 112,0,116,22– 112,22,120,32

• Too high– 116,0,238,22– 120,22,238,32

Page 44: Interacting With Users Chapter 7

Usemap Attribute

• Use the usemap attribute to apply an image map to any image on the page.

• There are many tools available to make image maps.

Page 45: Interacting With Users Chapter 7

Non-Rectangular Areas

• Circular areas:

• Polygonal areas:

– Draw the polygon starting with x1,y1 to x2,y2 to x3,y3 and so on until you get back to x1,y1 as the last value.

Page 46: Interacting With Users Chapter 7

Creating HTML Frames

Page 47: Interacting With Users Chapter 7

Frames

• You can divide the browser’s display surface into multiple windows called frames.

• Each frame can display a different part of the same page or a totally different page.

• Frame targeting can make clicks in one frame determine what gets displayed in another.

Page 48: Interacting With Users Chapter 7

Framesets

• A frameset splits the browser window into two or more subdocuments called frames. – Create a frameset with the <frameset> start

and </frameset> stop tags.• The start tag has row and column attributes that

determine the layout.

– Specify the dimensions by pixels or percentages.

Page 49: Interacting With Users Chapter 7

Framesets

Page 50: Interacting With Users Chapter 7

Vertical Frames

Page 51: Interacting With Users Chapter 7

Horizontal Frames

Page 52: Interacting With Users Chapter 7

Frameset Grids

Page 53: Interacting With Users Chapter 7

Nested Framesets

• A frameset that you create inside of another frame is called a nested frameset.

Page 54: Interacting With Users Chapter 7

Border, Scrollbar, Sizing

• To remove the border around a frameset, add the following attributes to the frameset tag:– frameborder="no" border="0" framespacing="0"

• To remove the scrollbar from a frame, add the following attribute to its frame tag:– scrolling="no"

• To prevent users from being able to resize a frame, add the noresize attribute to the frame tag.

Page 55: Interacting With Users Chapter 7

Border, Scrollbar, Sizing

Page 56: Interacting With Users Chapter 7

Fixed-Size Frames

Page 57: Interacting With Users Chapter 7

Wildcard Sized Frames

Page 58: Interacting With Users Chapter 7

Frame Targeting

• Frame targeting is when a mouse click in one frame can alter the display of a document in another frame.– Suppose you have a menu of items in the

left frame.– When you click on an item in the left frame,

you can make the targeted frame appear on the right side in the main content frame.

– See the next slide for the coding.

Page 59: Interacting With Users Chapter 7

Frame Targeting

• Name the frame (Main content) that the hyperlinks will target:

• Use the target tag to make the hyperlinks aim at the targeted frame (Sidebar).

– If the main content frame does not exist, a new window will be displayed.

Page 60: Interacting With Users Chapter 7

Base Tag

• You can avoid typing the target attribute in each hyperlink if you use the <base> tag to specify the default target of the sidebar links.

– The <base> tag goes into the <head> section of the document containing the hyperlinks.

– You can override this by hard-coding a different target on any hyperlink that you want pointing somewhere else.

Page 61: Interacting With Users Chapter 7

Base Tag

• The <base> tag also has a URL attribute in which you can specify the HTTP address of the targeted document.

• In an anchor tag in that same document, this would make href="#education" point to http://www.northpole.com/santa/resume.html#education

Page 62: Interacting With Users Chapter 7

Using Framesets

• Use judgment when using framesets.

– Multiple windows can be confusing, especially for users with disabilities.

Page 63: Interacting With Users Chapter 7

Publishing a Web Site via FTP

Page 64: Interacting With Users Chapter 7

Publishing a Web Site

• To publish a file on the World Wide Web means to transfer the file to a folder on a Web server so people around the world can access the file with a Web browser. – The default filename on most Web servers is

index.html• Sometimes, default.html is used.• Check with your Web server administrator for more

information.

Page 65: Interacting With Users Chapter 7

Getting Web Space

• Your ISP account mostly includes some space on your ISP’s Web server for a personal Web site.

• Your school or workplace may have space available for your usage.

• There are sites on the Web that provide free space.– Search Google for “free FTP Web space.”

Page 66: Interacting With Users Chapter 7

Web Space Address

• Find the name of your Web space address from your provider.

Page 67: Interacting With Users Chapter 7

Getting an FTP Client

• To find a free FTP client to use, search Google or Yahoo for the keywords “free ftp client.”– One such program is Core FTP Lite at http://

www.coreftp.com/

Page 68: Interacting With Users Chapter 7

Configuring Core FTP Lite

• Create a new FTP connection.– Host/IP/URL is your

FTP server.– User ID is the part of

your e-mail before the @ sign.

Page 69: Interacting With Users Chapter 7

FTP Files to Web Server

• The left pane in Core FTP Lite is your file structure; the right pane is the file structure of the Web server.

• The arrows let you move files from one pane to the other.

Page 70: Interacting With Users Chapter 7

Working With Files

• In addition, Core FTP Lite has buttons that allow you to delete or rename files on the Web server or your computer.

• Some file servers are case-sensitive, so you may name all of your files and folders using lowercase letters.

Page 71: Interacting With Users Chapter 7

Updating Your Web Page

• If you need to update your Web page, just republish the revised file to your Web site.

• Check the new page in your Web browser by having it reload or refresh the page.– You can press Shift as you press the Reload

button to make sure graphics are refreshed as well.

Page 72: Interacting With Users Chapter 7

Relative & Absolute Links

• Absolute links – Contain the full URL to

the file.

• Relative links – Contain only the part

of the URL not contained in your current Web page’s folder.

Page 73: Interacting With Users Chapter 7

Example

• For example, the full URL may be www.northpole.com/~santa/wishlist/danny.html

• But if your Web page home is located in www.northpole.com/~santa, the relative link would be wishlist/danny.html

Page 74: Interacting With Users Chapter 7

Good Directory Structure

• Be careful how you create folders and subfolders when you make a local Web that you plan to mount on the World Wide Web.

Page 75: Interacting With Users Chapter 7

File Permissions

• File permission attributes are settings that determine who is allowed to read and execute your files.– Right-click the

folder and choose Properties.

Page 76: Interacting With Users Chapter 7