CSC 551: Web Programming
Spring 2003
Test 1 Review
Overview
history of the Internet & the Web
static vs. dynamic pages
client-side vs. server-side programming
HyperText Markup Language (HTML)
tags vs. elements
structural elements: HTML, HEAD, BODY
text layout: BR,
text grouping: P, H1...H6, HR, DIV, SPAN, PRE, BLOCKQUOTE
text styles: B, I, TT, BIG, SMALL, SUB, SUP
lists: OL, UL, LI, DL, DT, DD
hyperlinks: A, attributes (HREF, TARGET, NAME)
images: IMG, attributes (SRC, ALT)
tables: TABLE, attributes (BORDER, FRAME, RULES, WIDTH, CELLSPACING, CELLPADDING)
TR/TD/TH, attributes (ALIGN, VALIGN, COLSPAN, ROWSPAN, BGCOLOR)
CAPTION
frames: FRAMESET, attributes (ROWS, COLS, FRAMEBORDER)
FRAME, attributes (SRC, NAME)
can specify link to open in frame using TARGET (_blank, _top, ...)
cascading style sheets
inline: STYLE attribute, property:value pairs
document: STYLE tags, subclasses of elements, pseudo-elements
external: LINK tag
Internet & Web Protocols
networking 7-layer model
Internet Protocol (IP): network layer
connectionless & unreliable, handles packet routing info
IP addresses, domain name servers, routers
Transmission Control Protocol (TCP): transport layer
provides virtual circuit, handles packet breakup and reassembly
ports, sequence & acknowledgement numbers to ensure delivery
HyperText Transfer Protocol (HTTP): application layer
HTTP/1.0 connectionless, HTTP/1.1 persistent connection (til timeout)
GET request headers: User-Agent, Authorization, If-Modified-Since
response headers: status code, Date, Last-modified, Content-type, ...
caching works through If-Modifed-Since, status code headers
cookies work through Cookie, Set-Cookie headers
other requests: HEAD, POST, PUT, DELETE
Client-side Programming with JavaScript
client-side execution, scripting vs. programming
code embedded in SCRIPT tags, output displayed in page
variables are loosely typed, don't have to declare
data types: string, number, boolean
operators, expressions, control statements similar to C++
predefined functions
document.write, prompt, parseFloat, Math.sqrt, Math.max, Math.random, ...
user-defined functions
similar to C++, but no return type, no parameter types
can specify local variables with var, can store in library file (SRC attribute)
String class: e.g., word = new String("foo"); or word = "foo";
properties include: length
methods include: charAt, substring, toUpperCase, indexOf
Array class: e.g., items = new Array(3); or items = [33, "foo", 15];
properties include: length
methods include: [], sort, reverse, slice, push, pop
Date class: e.g., today = new Date();
methods include: getYear, getMonth, ..., getMilliseconds
browser-defined objects
document: document.write(...), document.URL, document.lastModified
navigator: navigator.appName, navigator.appVersion
user-defined classes
awkward notation, no data hiding capabilities