View
220
Download
0
Embed Size (px)
Citation preview
Servers and Browsers
• Servers make web documents, which are specified in HTML, available on request to browsers
• Browsers display, to users, web documents which have been received from servers
Web Programming
• Programming for the World Wide Web involves both– server-side programming, and– client-side (browser-side) programming
Client-side programming
• In this module, we will consider the following mechanisms for client-side programming:– HTML 4.0– Cascading Style Sheets– Javascript
Server-side Programming
• In this module, we will consider – the Hyper Text Transfer Protocol (HTTP)– server-side programming in PHP
Assessment
• Of the marks available for the module,– 80% are available from the end-of-year written
examination– 20% are available from continuous assessment,
a series of in-class tests that will be administered from time to time
Assumption
• Some of you know a little HTML, but others do not know the language at all
• Beware that good HTML programming methodology is still evolving
• The most modern version of HTML is XHTML, which is very close to HTML 4
• We will adhere rigidly to HTML 4.0, even though browsers tend to be more tolerant
• XHTML will be introduced later
• HTML is the language used for specifying WWW documents
• A specification, in HTML, of a WWW document contains raw content (text) along with items called tags which are used to tell browsers about the content and to refer to non-text content
HTML Specification of a Simple Document
<html> <head> <title> Hello Document </title> </head> <body> Hello there </body> </html>
• The HTML fragment <title> Hello Document </title> tells the browser what title to place on the top line
of the browser display
• The HTML fragment <body> Hello there </body> tells the browser what to put in its content display region
Browsers treat documents slightly differently
• See how the document titles are placed differently on the top line of the browser
• See how the content display regions have different colours
Testing your web-site
• When you make you web-site live, it may be accessed by anybody on the WWW
• You have no idea which browser they will be using
• But it is a good idea to test you site on the most likely browsers
A tag pair contains something:
• The tag pair <html> … </html> contains a HTML specification of a document, including always– “header” information, that is info about the
document– the content of the document
• The tag pair <head> … </head> contains the header information about the document, including– the title of the document (always present)– other information (optional)
• the tag pair <title> … </title> contains the title of the document
Thus, the simplest HTML specification is of the form:
<html>
<head>
<title> Some-title </title>
</head>
<body> Some-content </body>
</html>
Example document spec:
<html>
<head>
<title> A silly document </title>
</head>
<body> Isn’t this easy???? </body>
</html>
Another example specification:
<html>
<head>
<title> Silly document #2 </title>
</head>
<body> Well, well!! </body>
</html>
Dividing text into paragraphs<html>
<head> <title> The Ironies of History </title> </head>
<body>
<p>In August 1914, a bullet was fired in Sarajevo which led,
indirectly, to the deaths of thousands of Congolese in 1999.
The bullet in Sarajevo caused World War I which, in turn, caused
the Russian Revolution. </p>
<p>The Russian Revolution led, eventually, to the Cold War. The Cold
War caused The West to support Mobutu in his kleptocratic rule of
the Congo, leading to such a breakdown of society that the Congo
has experienced a series of civil wars in the late 1990s. </p>
</body>
</html>