-
Notifications
You must be signed in to change notification settings - Fork 5
/
lecture02_Mod02_a_01_a.md.html
297 lines (297 loc) · 22.3 KB
/
lecture02_Mod02_a_01_a.md.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<meta name="author" content="Karl Benedict" />
<title>Geography 485L/585L - Internet Mapping</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<style type="text/css">
a.sourceLine { display: inline-block; line-height: 1.25; }
a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; }
a.sourceLine:empty { height: 1.2em; position: absolute; }
.sourceCode { overflow: visible; }
code.sourceCode { white-space: pre; position: relative; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
code.sourceCode { white-space: pre-wrap; }
a.sourceLine { text-indent: -1em; padding-left: 1em; }
}
pre.numberSource a.sourceLine
{ position: relative; }
pre.numberSource a.sourceLine:empty
{ position: absolute; }
pre.numberSource a.sourceLine::before
{ content: attr(data-line-number);
position: absolute; left: -5em; text-align: right; vertical-align: baseline;
border: none; pointer-events: all;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #aaaaaa;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
div.sourceCode
{ }
@media screen {
a.sourceLine::before { text-decoration: underline; }
}
code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code span.at { color: #7d9029; } /* Attribute */
code span.bn { color: #40a070; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code span.ch { color: #4070a0; } /* Char */
code span.cn { color: #880000; } /* Constant */
code span.co { color: #60a0b0; font-style: italic; } /* Comment */
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code span.do { color: #ba2121; font-style: italic; } /* Documentation */
code span.dt { color: #902000; } /* DataType */
code span.dv { color: #40a070; } /* DecVal */
code span.er { color: #ff0000; font-weight: bold; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #40a070; } /* Float */
code span.fu { color: #06287e; } /* Function */
code span.im { } /* Import */
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
code span.kw { color: #007020; font-weight: bold; } /* Keyword */
code span.op { color: #666666; } /* Operator */
code span.ot { color: #007020; } /* Other */
code span.pp { color: #bc7a00; } /* Preprocessor */
code span.sc { color: #4070a0; } /* SpecialChar */
code span.ss { color: #bb6688; } /* SpecialString */
code span.st { color: #4070a0; } /* String */
code span.va { color: #19177c; } /* Variable */
code span.vs { color: #4070a0; } /* VerbatimString */
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
</style>
<link rel="stylesheet" href="page.css">
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<header>
<h1 class="title">Geography 485L/585L - Internet Mapping</h1>
<p class="author">Karl Benedict</p>
<p class="date">Spring 2018</p>
</header>
<!---------------------------------------------------------------------------->
<!-- Week 02 ----------------------------------------------------------------->
<!-- Lecture 02 a 01 --------------------------------------------------------->
<!-- Web-based Mapping Clients------------------------------------------------>
<!-- Introduction to HTML, CSS and Javascript--------------------------------->
<!---------------------------------------------------------------------------->
<h1 id="week-2---module-2a---web-based-mapping-clients.-html-css-javascript">Week 2 - Module 2a - Web-based Mapping Clients. HTML, CSS & Javascript</h1>
<h3 id="overview" class="module02a01">Overview</h3>
<ul>
<li>Web Development</li>
<li>Parts of a web page</li>
<li>Web Site Components
<ul>
<li>Structure (X/HTML)</li>
<li>Presentation (CSS)</li>
<li>Behavior (Javascript)</li>
</ul></li>
<li>Simple Web Pages</li>
<li>More Complete Web Page Example</li>
</ul>
<h3 id="web-development" class="module02a01">Web Development</h3>
<ul>
<li>Requirements
<ul>
<li>Web Server</li>
<li>File location that the web server accesses for requested content</li>
<li>Files must be readable by all users</li>
</ul></li>
<li>General Process
<ul>
<li>Create basic content in HTML or XHTML (structure)</li>
<li>Change appearance of content through the definitions of styles using CSS (presentation)</li>
<li>Add dynamic capabilities to content through Javascript (behavior)</li>
<li>REPEAT over and over and over and over again</li>
</ul></li>
</ul>
<h3 id="parts-of-a-web-page" class="module02a01">Parts of a Web Page</h3>
<div class="sourceCode" id="cb1"><pre class="sourceCode numberSource html numberLines"><code class="sourceCode html"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="kw"><html></span></a>
<a class="sourceLine" id="cb1-2" data-line-number="2"> <span class="co"><!-- The HTML block is the container for all of your page content --></span></a>
<a class="sourceLine" id="cb1-3" data-line-number="3"> <span class="kw"><head></span></a>
<a class="sourceLine" id="cb1-4" data-line-number="4"> <span class="co"><!-- The head is where you include pointers to external resources </span></a>
<a class="sourceLine" id="cb1-5" data-line-number="5"><span class="co"> (i.e. style sheets and javascript files), blocks of Javascript code</span></a>
<a class="sourceLine" id="cb1-6" data-line-number="6"><span class="co"> , styles, etc. --></span></a>
<a class="sourceLine" id="cb1-7" data-line-number="7"> <span class="kw"><title></span>The page title also goes in here<span class="kw"></title></span></a>
<a class="sourceLine" id="cb1-8" data-line-number="8"> <span class="kw"></head></span></a>
<a class="sourceLine" id="cb1-9" data-line-number="9"> <span class="kw"><body></span></a>
<a class="sourceLine" id="cb1-10" data-line-number="10"> <span class="co"><!-- The body is where you put all of the content for the page </span></a>
<a class="sourceLine" id="cb1-11" data-line-number="11"><span class="co"> (i.e. the material that will be displayed in the web browser) --></span></a>
<a class="sourceLine" id="cb1-12" data-line-number="12"> <span class="kw"><h1></span>Headers<span class="kw"></h1></span></a>
<a class="sourceLine" id="cb1-13" data-line-number="13"> <span class="kw"><div></span>Generic blocks of content<span class="kw"></div></span></a>
<a class="sourceLine" id="cb1-14" data-line-number="14"> <span class="kw"><p></span>Paragraphs<span class="kw"></p></span></a>
<a class="sourceLine" id="cb1-15" data-line-number="15"> <span class="kw"><table></span>Tables<span class="kw"></table></span></a>
<a class="sourceLine" id="cb1-16" data-line-number="16"> <span class="kw"><img</span> <span class="er">...</span><span class="kw">></span>Images<span class="kw"></img></span></a>
<a class="sourceLine" id="cb1-17" data-line-number="17"> <span class="kw"><form</span> <span class="er">...</span><span class="kw">></span>Forms<span class="kw"></form></span></a>
<a class="sourceLine" id="cb1-18" data-line-number="18"> <span class="kw"><ul></span>Unordered Lists<span class="kw"></ul></span></a>
<a class="sourceLine" id="cb1-19" data-line-number="19"> <span class="kw"><ol></span>Ordered Lists<span class="kw"></ol></span></a>
<a class="sourceLine" id="cb1-20" data-line-number="20"> <span class="kw"><li></span>List Items<span class="kw"></li></span></a>
<a class="sourceLine" id="cb1-21" data-line-number="21"> </a>
<a class="sourceLine" id="cb1-22" data-line-number="22"> <span class="co"><!-- Javascript can go here as well --></span></a>
<a class="sourceLine" id="cb1-23" data-line-number="23"> <span class="kw"></body></span></a>
<a class="sourceLine" id="cb1-24" data-line-number="24"><span class="kw"></html></span></a></code></pre></div>
<p><a href="https://karlbenedict.github.io/GEOG485-585/sample-files/example02_01_01.html">Link to example</a></p>
<h3 id="web-site-components---structure" class="module02a01">Web Site Components - Structure</h3>
<p>Content is defined in terms of the structural elements available in HTML/XHTML</p>
<ul>
<li>Sample HTML/XHTML Tags
<ul>
<li>Paragraphs (i.e. blocks of text) are contained within <code><p>...</p></code> tags</li>
<li>Headings (i.e. section headings, sub-headings) are contained within numerically defined header tags: <code><h1>...</h1>, <h2>...</h2>, <h3>...</h3></code>, etc.</li>
<li>Tabular data are within <code><table>...</table></code> tags</li>
<li>List are specified within <code><ol>...</ol></code> or <code><ul>...</ul></code> tags, depending upon whether the list is ordered (numbered) or unordered (e.g. bulleted)</li>
<li>User input elements are put within <code><form>...</form></code> tags</li>
<li>Blocks of content (i.e. sections or divisions) are defined within <code><div>...</div></code> tags</li>
</ul></li>
<li>Structure is translated into the Document Object Model (DOM) for later use by CSS and Javascript</li>
</ul>
<h3 id="web-site-components---presentation" class="module02a01">Web Site Components - Presentation</h3>
<p>Modifications to default rendering of HTML/XHTML elements are made through styles defined in CSS</p>
<ul>
<li>Styles may be
<ul>
<li>defined in an external file that is referenced within the <code><head></code> block (the preferred method when doing “real” web development)</li>
<li>directly defined within the <code><head></code> block of a web page</li>
<li>directly embedded in the elements to which they apply (generally not a “Good Thing”)</li>
</ul></li>
<li>When not embedded within an element, a style definition consists of
<ul>
<li>A selector</li>
<li>The style definition, enclosed in “curly-brackets”, separated by “semi-colons”</li>
<li>For example: <code>h1 {color:red; font-size:18px;}</code></li>
</ul></li>
</ul>
<h3 id="css-selectors" class="module02a01">CSS Selectors</h3>
<p>Selectors may be based on several criteria</p>
<ul>
<li>Element name: <code>h1</code>, <code>p</code>, <code>table</code>, <code>ul</code>, etc.
<ul>
<li>Element: <code><h1>A top level heading</h1></code></li>
<li>Selector: <code>h1 {color:red; font-size:18px}</code></li>
</ul></li>
<li>Element ID: a unique name assigned to HTML/XHTML elements within the structure of the document
<ul>
<li>Element: <code><p id=”para01”>Some text goes here</p></code></li>
<li>Selector: <code>#para01 {color:blue; font-size:12px}</code></li>
</ul></li>
<li>Class ID: a name assigned to multiple elements which may be modified through reference to their class
<ul>
<li>Element: <code><p class=”instructions”>Here are some instructions</p></code></li>
<li>Another Element: <code><p class=”instructions”>Here are some more instructions</p></code></li>
<li>Selector: <code>.instructions {color:red; font-size:12px; text-decoration:blink}</code></li>
</ul></li>
<li>Selectors may be combined in a variety of ways</li>
</ul>
<h3 id="web-site-components---behavior" class="module02a01">Web Site Components - Behavior</h3>
<p>The most interoperable language for adding dynamic behavior to web sites is <em>Javascript</em> - supported by most browsers on most operating systems</p>
<ul>
<li>A full-fledged programming language
<ul>
<li>A non-trivial undertaking to become proficient in</li>
<li>Experience in other programming languages can contribute to learning Javascript</li>
</ul></li>
<li>Defines actions that may be taken on/by DOM elements</li>
<li>Allows for modification of existing DOM elements, creation of new DOM elements after the page has finished loading from the server, retrieval of new content after page loads
<ul>
<li>An interactive web page that may behave like a local desktop application</li>
</ul></li>
</ul>
<h3 id="reference-links" class="module02a01">Reference Links</h3>
<ul>
<li>w3schools.com
<ul>
<li><a href="http://www.w3schools.com/html/html5_intro.asp">HTML 5.0 Introduction</a></li>
<li><a href="http://www.w3schools.com/tags/default.asp">HTML 4.0 / XHTML 1.0 Tag Reference</a></li>
<li><a href="http://www.w3schools.com/css/default.asp">Cascading Style Sheet (CSS) selectors and elements</a></li>
<li><a href="http://www.w3schools.com/js/default.asp">Javascript reference</a></li>
</ul></li>
<li>World Wide Web Consortium (W3C)
<ul>
<li><a href="http://www.w3.org/standards/webdesign/htmlcss">HTML and CSS Background</a></li>
<li><a href="http://www.w3.org/2002/03/tutorials.html#webdesign_htmlcss">HTML and CSS Tutorial Links Page</a></li>
<li><a href="http://validator.w3.org/">Validators Page</a></li>
</ul></li>
<li>Webmonkey.com
<ul>
<li><a href="https://www.wired.com/2010/02/html_cheatsheet/">HTML Cheat Sheet</a></li>
<li><a href="https://www.wired.com/2010/02/css-guide/">CSS Guide</a></li>
</ul></li>
</ul>
<h3 id="simple-web-page" class="module02a01">Simple Web Page</h3>
<div class="sourceCode" id="cb2"><pre class="sourceCode numberSource html numberLines"><code class="sourceCode html"><a class="sourceLine" id="cb2-1" data-line-number="1"><span class="kw"><html></span></a>
<a class="sourceLine" id="cb2-2" data-line-number="2"> <span class="kw"><head></span></a>
<a class="sourceLine" id="cb2-3" data-line-number="3"> <span class="kw"><meta</span><span class="ot"> http-equiv=</span><span class="st">"Content-Type"</span><span class="ot"> content=</span><span class="st">"text/html;charset=utf-8"</span> <span class="kw">/></span></a>
<a class="sourceLine" id="cb2-4" data-line-number="4"> <span class="kw"><title></span>This is a simple web page<span class="kw"></title></span></a>
<a class="sourceLine" id="cb2-5" data-line-number="5"> <span class="kw"></head></span></a>
<a class="sourceLine" id="cb2-6" data-line-number="6"> <span class="kw"><body></span></a>
<a class="sourceLine" id="cb2-7" data-line-number="7"> <span class="kw"><h1></span>They don't get any simpler than this!<span class="kw"></h1></span></a>
<a class="sourceLine" id="cb2-8" data-line-number="8"> <span class="kw"><p></span>OK, not much simpler than this.<span class="kw"></p></span></a>
<a class="sourceLine" id="cb2-9" data-line-number="9"> <span class="kw"><p></span>Hello World?<span class="kw"></p></span></a>
<a class="sourceLine" id="cb2-10" data-line-number="10"> <span class="kw"></body></span></a>
<a class="sourceLine" id="cb2-11" data-line-number="11"><span class="kw"></html></span></a></code></pre></div>
<p><a href="https://karlbenedict.github.io/GEOG485-585/sample-files/example02_01_02.html">link to example</a></p>
<h3 id="simple-web-page-with-css">Simple Web Page with CSS</h3>
<div class="sourceCode" id="cb3"><pre class="sourceCode numberSource html numberLines"><code class="sourceCode html"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="kw"><html></span></a>
<a class="sourceLine" id="cb3-2" data-line-number="2"> <span class="kw"><head></span></a>
<a class="sourceLine" id="cb3-3" data-line-number="3"> <span class="kw"><meta</span><span class="ot"> http-equiv=</span><span class="st">"Content-Type"</span><span class="ot"> content=</span><span class="st">"text/html;charset=utf-8"</span> <span class="kw">/></span></a>
<a class="sourceLine" id="cb3-4" data-line-number="4"> <span class="kw"><title></span>This is a simple web page - with styling<span class="kw"></title></span></a>
<a class="sourceLine" id="cb3-5" data-line-number="5"> <span class="kw"><style</span><span class="ot"> type=</span><span class="st">"text/css"</span><span class="kw">></span></a>
<a class="sourceLine" id="cb3-6" data-line-number="6"> h1 {<span class="kw">color</span>:<span class="dv">blue</span>; <span class="kw">font-size</span>:<span class="dv">large</span>}</a>
<a class="sourceLine" id="cb3-7" data-line-number="7"> p<span class="fu">.para</span> {<span class="kw">color</span>:<span class="dv">#777777</span>; <span class="kw">font-size</span>:<span class="dv">small</span>}</a>
<a class="sourceLine" id="cb3-8" data-line-number="8"> <span class="pp">#annoying</span> {<span class="kw">color</span>:<span class="dv">red</span>; <span class="kw">text-decoration</span>:<span class="dv">line-through</span>}</a>
<a class="sourceLine" id="cb3-9" data-line-number="9"> <span class="kw"></style></span></a>
<a class="sourceLine" id="cb3-10" data-line-number="10"> <span class="kw"></head></span></a>
<a class="sourceLine" id="cb3-11" data-line-number="11"> <span class="kw"><body></span></a>
<a class="sourceLine" id="cb3-12" data-line-number="12"> <span class="kw"><h1></span>They don't get any simpler than this!<span class="kw"></h1></span></a>
<a class="sourceLine" id="cb3-13" data-line-number="13"> <span class="kw"><p</span><span class="ot"> class=</span><span class="st">"para"</span><span class="kw">></span>OK, not much simpler than this.<span class="kw"></p></span></a>
<a class="sourceLine" id="cb3-14" data-line-number="14"> <span class="kw"><p</span><span class="ot"> id=</span><span class="st">"annoying"</span><span class="ot"> class=</span><span class="st">"para"</span><span class="kw">></span>Hello World?<span class="kw"></p></span></a>
<a class="sourceLine" id="cb3-15" data-line-number="15"> <span class="kw"></body></span></a>
<a class="sourceLine" id="cb3-16" data-line-number="16"><span class="kw"></html></span></a></code></pre></div>
<p><a href="https://karlbenedict.github.io/GEOG485-585/sample-files/example02_01_03.html">link to example</a></p>
<h3 id="simple-web-page-with-javascript">Simple Web Page with Javascript</h3>
<div class="sourceCode" id="cb4"><pre class="sourceCode numberSource html numberLines"><code class="sourceCode html"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="kw"><html></span></a>
<a class="sourceLine" id="cb4-2" data-line-number="2"> <span class="kw"><head></span></a>
<a class="sourceLine" id="cb4-3" data-line-number="3"> <span class="kw"><meta</span><span class="ot"> http-equiv=</span><span class="st">"Content-Type"</span><span class="ot"> content=</span><span class="st">"text/html;charset=utf-8"</span> <span class="kw">/></span></a>
<a class="sourceLine" id="cb4-4" data-line-number="4"> <span class="kw"><title></span>This is a simple web page with Javascript<span class="kw"></title></span></a>
<a class="sourceLine" id="cb4-5" data-line-number="5"> <span class="kw"><script</span><span class="ot"> type=</span><span class="st">"text/javascript"</span><span class="kw">></span></a>
<a class="sourceLine" id="cb4-6" data-line-number="6"> <span class="kw">function</span> <span class="at">genericAlert</span>() <span class="op">{</span></a>
<a class="sourceLine" id="cb4-7" data-line-number="7"> <span class="at">alert</span>(<span class="st">"You just did something ..."</span>)</a>
<a class="sourceLine" id="cb4-8" data-line-number="8"> <span class="va">document</span>.<span class="at">getElementById</span>(<span class="st">"clickMe"</span>).<span class="va">style</span>.<span class="at">color</span> <span class="op">=</span> <span class="st">"red"</span></a>
<a class="sourceLine" id="cb4-9" data-line-number="9"> <span class="op">}</span></a>
<a class="sourceLine" id="cb4-10" data-line-number="10"> <span class="kw"></script></span></a>
<a class="sourceLine" id="cb4-11" data-line-number="11"> <span class="kw"></head></span></a>
<a class="sourceLine" id="cb4-12" data-line-number="12"> <span class="kw"><body></span></a>
<a class="sourceLine" id="cb4-13" data-line-number="13"> <span class="kw"><h1></span>They don't get any simpler than this!<span class="kw"></h1></span></a>
<a class="sourceLine" id="cb4-14" data-line-number="14"> <span class="kw"><p></span>OK, not much simpler than this.<span class="kw"></p></span></a>
<a class="sourceLine" id="cb4-15" data-line-number="15"> <span class="kw"><p></span>Hello World?<span class="kw"></p></span></a>
<a class="sourceLine" id="cb4-16" data-line-number="16"> <span class="kw"><p</span><span class="ot"> id=</span><span class="st">"clickMe"</span><span class="ot"> onclick=</span><span class="st">"genericAlert();"</span><span class="kw">></span>What happens when you click me?<span class="kw"></p></span></a>
<a class="sourceLine" id="cb4-17" data-line-number="17"> <span class="kw"></body></span></a>
<a class="sourceLine" id="cb4-18" data-line-number="18"><span class="kw"></html></span></a></code></pre></div>
<p><a href="https://karlbenedict.github.io/GEOG485-585/sample-files/example02_01_04.html">link to example</a></p>
<hr />
<section>
<div class="license">
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a><br />This work by <span data-xmlns:cc="http://creativecommons.org/ns#" data-property="cc:attributionName">Karl Benedict</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.
</div>
</section>
</body>
</html>