620 likes | 731 Views
Java script and DHTML COMPSCI 381 Class Hour: 3:45pm – 5:00pm MW. A little bit about the instructor. Assistant professor at UWW since August 2005. Graduated from the University of Connecticut (05 Class), Ph.D in Computer Science and Engineering.
E N D
Java script and DHTMLCOMPSCI 381Class Hour: 3:45pm – 5:00pm MW
A little bit about the instructor Assistant professor at UWW since August 2005 • Graduated from the University of Connecticut (05 Class), Ph.D in Computer Science and Engineering • Master of Computer Science from UW-Milwaukee (96-99) • Bachelor of Science from Hanoi University of Technology (86-91)
Contact information nguyenh@uww.edu (fastest way to contact me) Office: McCutchan room 424 Office Hours: 9am – 11am MW or 1-2pm W or by appointment 262 472 5170
Course Objectives Design a web interface for an web application. It needs to show samples, have links to description, price, warrant info, and shopping cart. It should allow users to pay by credit card…. Implement and test the interface
Course detail - Topics Design, implement, an interface for web development Understand the requirement Apply skillfully Javascript & DHTML techniques Documentation Testing
Getting started • Let’s overview HTML
Assessment 1. The home page for a Web site is usually contained in a file named ___________ . a. index.html b. homepage.html c. default.html d. homepage.asp.
Assessment 2. You are given an URL = http://www.awl.com/index.html. What is the host name? a. http:// b. www.awl.com c. index.html d. awl e. None of the above
Assessment 3. Select the attribute in the following line of HTML code <table width=”350”>. a. width b. width=”350” c. Table d. None of the above
Assessment 4. The variable bgcolor is use to set the background color. What variable would be used to indicate that a site had been previously entered? a. alink b. elink c. vlink d. zlink e. None of the above
Assessment 5. Select the tag that starts all HTML documents. a. <BEGIN> b. <START> c. <HTML> d. <FIRST> e. None of the above
Assessment 6. A link to another page begins with <a href. Select the name that best describes this tag. a. anchor b. pointer c. address d. a reference e. None of the above
Assessment 7. Select the HTML code for the tag of a comment. a. <!- your comment -> b.<—your comment c.< -- your comment -- > d. >!—your comment --< e. None of the above
Assessment 8. Which part of an application formats and displays web pages? a. The information server b. The web browser c. The database server d. None of the above
Assessment 9. The following CSS code creates a body tag with a black background and white text. BODY { background: black; text: white; } a. TRUE b. FALSE
Assessment 10. The <H7> tag produces a heading with the largest font size. a. FALSE b. TRUE
HTML overview • An HTML document consists of lines of text with embedded markup tags that specify Web-page formatting and links to other pages • Invented by Tim Berners-Lee at CERN 1989 • The birth of the World Wide Web
http://www.w3.org/TR/REC-html40/ Protocol Host Machine Name URLs, Anchor Tags, and Document References
URLs, Anchor Tags, and Document References • URL (Uniform Resource Locator) • A protocol, a mechanism used to fetch the desired object. • In this case: http (Hypertext Transfer Protocol). • The host machine, the computer that contains the requested object. • In this case, the host computer is www.w3.org. • Special host name for browser computer: localhost • The object name. • In this case, /TR/REC-html40/.
Fundamentals of HTML • HTML, HEAD, Title, Body • Headings and paragraphs • Add emphasis to your text • Use various kinds of lists • Add links to other pages • Add images • Add links to other pages
<HTML> and </HTML> • <HTML> The <HTML> tag is the first tag in your document. It tells the Internet browser that it is reading an HTML document (without it, the browser would think it was viewing a text document). • </HTML> This is the closing tag for the <HTML> tag. This should be the last line in your HTML document.
<HEAD> and </HEAD> • <HEAD> Used to contain information such as title, style sheets • </HEAD>: This is the closing <HEAD> tag.
<TITLE> and </TITLE> • <TITLE> and </TITLE> • It is used to make the title of the page. The title of the page will appear in the blue bar across the top of your active window Example: <TITLE> Basic HTML </TITLE>
<BODY> and </BODY> • <BODY> and </BODY> We put all your text, images, and links between the opening and closing <BODY> tags.
Headings and paragraphs • There are up to six levels of headers that can be used in your document, H1 through H6. Header 1 is the largest header and they get progressively smaller through header 6.
Example • <h1>This is a header 1 tag</h1> This is a header 1 tag • <h2>This is a header 2 tag</h2> This is a header 2 tag
Add emphasis to your text • Boldface This is a <b>boldface</b> tag. This is a boldface tag. • Italics This is an <i>italic</i> tag. This is an italic tag.
Lists Numbered <ol> <li> list item 1 <li> list item 2 <li> list item 3 </ol>
Lists Unumbered: <ul> <li> list item 1 <li> list item 2 <li> list item 3 </ul>
Lists • Definition lists allow you to indent without necessarily having to use bullets. • <dl> <dt> This is a term <dd> This is a definition <dd> And yet another definition <dt> Another term <dd> Another definition </dl>
Center • You can center text, images, and headings with the center tag: <center>This is a centered sentence</center> • The center tag automatically inserts a line break after the closing center tag.
File names • Use lowercase file names • User proper extension: • *.html or *.htm
Designing a web site • Determine the purpose of the web site • Determine the target audience • Determine numbers of pages • Sketch the site on paper
Example of HTML <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>My first Web site</title> </head> <body> <!-- Site navigation menu --> <ul> <li><a href="index.html">Home page</a> <li><a href="musings.html">Musings</a> <li><a href="town.html">My town</a> <li><a href="links.html">Links</a> </ul> <!-- Main content --> <h1>My first styled page</h1> <p>Welcome to my first page! </body> </html>
Adding color <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>My first web page</title> <style type="text/css"> body { color: purple; background-color: #d8da3d } </style> </head> …… <body>
Style sheet • Style sheets in CSS are made up of rules. Each rule has three parts: • the selector (in the example: “body”), which tells the browser which part of the document is affected by the rule; • the property (in the example, 'color' and 'background-color' are both properties), which specifies what aspect of the layout is being set; • and the value ('purple' and '#d8da3d'), which gives the value for the style property.
Style sheet • Style sheets in CSS are made up of rules. Each rule has three parts: • the selector (in the example: “body”), which tells the browser which part of the document is affected by the rule; • the property (in the example, 'color' and 'background-color' are both properties), which specifies what aspect of the layout is being set; • and the value ('purple' and '#d8da3d'), which gives the value for the style property.
Style sheet • Style sheets in CSS are made up of rules. Each rule has three parts: • the selector (in the example: “body”), which tells the browser which part of the document is affected by the rule; • the property (in the example, 'color' and 'background-color' are both properties), which specifies what aspect of the layout is being set; • and the value ('purple' and '#d8da3d'), which gives the value for the style property.
Adding color <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html> <head> <title>My first web page</title> <style type="text/css"> body { color: purple; background-color: #d8da3d } </style> </head> …… <body>
Style sheet • Style sheets in CSS are made up of rules. Each rule has three parts: • the selector (in the example: “body”), which tells the browser which part of the document is affected by the rule; • the property (in the example, 'color' and 'background-color' are both properties), which specifies what aspect of the layout is being set; • and the value ('purple' and '#d8da3d'), which gives the value for the style property.
Look at the example again <style type="text/css"> body { color: purple; background-color: #d8da3d } </style> SELECTOR value property
Creating a Style rule • Step 1: Determine Selector (which identifies the elements you wish to format). Put { next to it Example: h1{ • Step 2: Determine property: value in which property is the name of CSS property that applies this format and value is one of valid options for that property Example: color:red • Step 3: Combine the results of step 1 and step 2 and put } at the end. If you have more than one property: value pairs, use semicolon (;) to separate them. Example: h1{color:red}
Creating a selector • The type or name of elements For instance: body, paragraph • The context in which the element is found For instance: paragraphs in the middle of the web page • The class or id of an element For instance: the name of a paragraph in a web page.
Examples • For the type or name of elements h2 {color:red} h1 {color: purple} • The context in which the element is found div#gaudi p {color:red} • The class or id of an element div#gaudi {color:red}