-
Notifications
You must be signed in to change notification settings - Fork 0
/
The View-User Interaction.html
282 lines (205 loc) · 14.2 KB
/
The View-User Interaction.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
<!DOCTYPE html>
<html lang="en"><head>
<title>The View-User Interaction</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href="The%20View-User%20Interaction_files/style.css" media="all" type="text/css" rel="stylesheet">
<style type="text/css">#yddContainer{display:block;font-family:Microsoft YaHei;position:relative;width:100%;height:100%;top:-4px;left:-4px;font-size:12px;border:1px solid}#yddTop{display:block;height:22px}#yddTopBorderlr{display:block;position:static;height:17px;padding:2px 28px;line-height:17px;font-size:12px;color:#5079bb;font-weight:bold;border-style:none solid;border-width:1px}#yddTopBorderlr .ydd-sp{position:absolute;top:2px;height:0;overflow:hidden}.ydd-icon{left:5px;width:17px;padding:0px 0px 0px 0px;padding-top:17px;background-position:-16px -44px}.ydd-close{right:5px;width:16px;padding-top:16px;background-position:left -44px}#yddKeyTitle{float:left;text-decoration:none}#yddMiddle{display:block;margin-bottom:10px}.ydd-tabs{display:block;margin:5px 0;padding:0 5px;height:18px;border-bottom:1px solid}.ydd-tab{display:block;float:left;height:18px;margin:0 5px -1px 0;padding:0 4px;line-height:18px;border:1px solid;border-bottom:none}.ydd-trans-container{display:block;line-height:160%}.ydd-trans-container a{text-decoration:none;}#yddBottom{position:absolute;bottom:0;left:0;width:100%;height:22px;line-height:22px;overflow:hidden;background-position:left -22px}.ydd-padding010{padding:0 10px}#yddWrapper{color:#252525;z-index:10001;background:url(chrome-extension://eopjamdnofihpioajgfdikhhbobonhbb/ab20.png);}#yddContainer{background:#fff;border-color:#4b7598}#yddTopBorderlr{border-color:#f0f8fc}#yddWrapper .ydd-sp{background-image:url(chrome-extension://eopjamdnofihpioajgfdikhhbobonhbb/ydd-sprite.png)}#yddWrapper a,#yddWrapper a:hover,#yddWrapper a:visited{color:#50799b}#yddWrapper .ydd-tabs{color:#959595}.ydd-tabs,.ydd-tab{background:#fff;border-color:#d5e7f3}#yddBottom{color:#363636}#yddWrapper{min-width:250px;max-width:400px;}</style>
<script src="The%20View-User%20Interaction_files/a.js" async="" type="text/javascript"></script><script src="The%20View-User%20Interaction_files/analytics.js" async=""></script><script src="The%20View-User%20Interaction_files/embed.js" async="" type="text/javascript"></script></head>
<body>
<header>
<section class="logo">
<h1><a href="http://webcoursify.github.io/">WebDev Course</a></h1>
<h2 class="subheader">by Tyrone Cheung</h2>
</section>
<nav id="nav">
<ul>
<li><a href="http://webcoursify.github.io/about">ReadMe</a></li>
<li><a href="http://webdemo.zhangty.me/">Project Demo</a></li>
<li><a href="http://webcoursify.github.io/project_code">Download Project</a></li>
<li><a href="http://eepurl.com/_YOyb">Subscribe update</a></li>
<li><a href="mailto:firstprayer.zhang@gmail.com">Contact</a></li>
</ul>
</nav>
</header>
<div class="container">
<div class="content">
<article>
<h1>The View-User Interaction</h1>
<h5>Last modified: 12-29-2014</h5>
<p>In this chapter, we’ll look at the <em>View</em> layer. This
layer handles user interface as well as user interaction. That is, every
webpage user can see and interact with. We’ll first review <em>html</em>, <em>css</em> and <em>javascript</em> here. Then, we’ll start from that, to see how to implement complex functionalities of a website.</p>
<h3 id="html-css-javascript">HTML, CSS, Javascript</h3>
<p>HTML, CSS, Javascript are languages used to construct the three core components in modern web pages. </p>
<ul>
<li>HTML is the “language” used to describe the structure and content of a web page. </li>
<li><em>CSS</em> is a style sheet language used for describing the
look and formatting of a document written in a markup language, such as
HTML. </li>
<li><em>Javascript</em>, when used on <em>View</em>, is used to
program the dynamic behaviors of web pages, such as “what happen when
the user click this button”; or render contents beyond the
representation capability of HTML and CSS, such as 2D & 3D
animations. </li>
</ul>
<p>There’re many fantastic tutorials where you can learn the basic syntax and usage of these three “hammers”. </p>
<p><em>Note: when learning javascript, I suggest you first understand
the syntax and basic usage; then when you go to the part about how to
use javascript to manipulate DOM(html elements in web page), you can
also learn how to use <a href="http://jquery.com/">jQuery</a>, which provides a much nicer interface for selecting and do operations on DOM</em></p>
<ul>
<li>W3Schools: <a href="http://www.w3schools.com/html/">HTML</a>, <a href="http://www.w3schools.com/css/default.asp">CSS</a>. Great tutorials to help you understand the basic. The <a href="http://www.w3schools.com/jquery/">jQuery tutorial</a> is also very helpful</li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web">Mozilla Developer Guid</a>: Pretty detailed and comprehensive introductions</li>
<li><a href="http://htmldog.com/guides/html/beginner/">Here</a> is another tutorial for HTML, with more detailed text explanations</li>
<li><a href="http://www.codecademy.com/en/tracks/web">Codecademy</a> is also a good resource. It provides really good programming interface for practising</li>
</ul>
<p>You probably don’t want to go through all of the tutorials above,
because you don’t need to. Neither do you need to completely go through
any one of them. Different people have different ways of learning
things. The way I see it, you just need to know the basics to move
forward, and you’ll have a deeper understanding of these basic things
and learn more complex things during the rest of this chapter as well as
the finishing the assignments. Of course, my approach might not fit
you, you have your way of learning. But if you haven’t tried this way,
you might want to give it a shot and see if it’s suitable for you.</p>
</article>
<div id="disqus_thread"><iframe verticalscrolling="no" horizontalscrolling="no" src="The%20View-User%20Interaction_files/a.html" style="width: 100% ! important; border: medium none ! important; overflow: hidden ! important; height: 585px ! important;" title="Disqus" tabindex="0" scrolling="no" allowtransparency="true" data-disqus-uid="2" id="dsq-2" frameborder="0" width="100%"></iframe></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'webcoursify'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
</div>
<aside class="sidebar">
<section class="module">
<h2 style="margin-left: 24px;">FullStack Web Development</h2>
<ul class="lesson-list chapter-list">
<li data-url="/content/0-Preface.html">
<a href="http://webcoursify.github.io/content/0-Preface.html">
<span class="lesson-title">1 - Preface</span>
</a>
</li>
<li data-url="/content/1-DjangoBasic">
<a href="http://webcoursify.github.io/content/1-DjangoBasic">
<span class="lesson-title">2 - Django Basic</span>
</a>
<ul class="section-list">
<li data-url="/content/1-DjangoBasic/1-ClientServer.html"><a href="http://webcoursify.github.io/content/1-DjangoBasic/1-ClientServer.html">1 - Client-Server Model and MVC Design Pattern</a></li>
<li data-url="/content/1-DjangoBasic/2-DjangoMVC.html"><a href="http://webcoursify.github.io/content/1-DjangoBasic/2-DjangoMVC.html">2 - Django's MVC</a></li>
<li data-url="/content/1-DjangoBasic/3-Assignment.html"><a href="http://webcoursify.github.io/content/1-DjangoBasic/3-Assignment.html">3 - Assignment-Django Basic</a></li>
</ul>
</li>
<li data-url="/content/2-MVC-Controller">
<a href="http://webcoursify.github.io/content/2-MVC-Controller">
<span class="lesson-title">3 - Intro to Django's Controller</span>
</a>
<ul class="section-list">
<li data-url="/content/2-MVC-Controller/1-DjangoReqRes.html"><a href="http://webcoursify.github.io/content/2-MVC-Controller/1-DjangoReqRes.html">1 - Django's HttpRequest, HttpResponse, and Url dispatching</a></li>
<li data-url="/content/2-MVC-Controller/2-Assignment.html"><a href="http://webcoursify.github.io/content/2-MVC-Controller/2-Assignment.html">2 - Assignment for Implementing Controller</a></li>
</ul>
</li>
<li data-url="/content/3-MVC-Model">
<a href="http://webcoursify.github.io/content/3-MVC-Model">
<span class="lesson-title">4 - Model Layer in Django</span>
</a>
<ul class="section-list">
<li data-url="/content/3-MVC-Model/1-DjangoModel.html"><a href="http://webcoursify.github.io/content/3-MVC-Model/1-DjangoModel.html">1 - Using Model in Django</a></li>
<li data-url="/content/3-MVC-Model/2-FurtherDiscussion.html"><a href="http://webcoursify.github.io/content/3-MVC-Model/2-FurtherDiscussion.html">2 - Further discussion with regard to Model</a></li>
<li data-url="/content/3-MVC-Model/3-Assignment.html"><a href="http://webcoursify.github.io/content/3-MVC-Model/3-Assignment.html">3 - Assignments for Model</a></li>
</ul>
</li>
<li class="active" data-url="/content/4-MVC-View">
<a href="http://webcoursify.github.io/content/4-MVC-View">
<span class="lesson-title">5 - The View-User Interaction</span>
</a>
<ul class="section-list">
<li data-url="/content/4-MVC-View/2-DjangoTemplate.html"><a href="http://webcoursify.github.io/content/4-MVC-View/2-DjangoTemplate.html">1 - Template in Django</a></li>
<li data-url="/content/4-MVC-View/3-FormAjax.html"><a href="http://webcoursify.github.io/content/4-MVC-View/3-FormAjax.html">2 - Form, Ajax</a></li>
<li data-url="/content/4-MVC-View/4-RichEditor.html"><a href="http://webcoursify.github.io/content/4-MVC-View/4-RichEditor.html">3 - Using Rich Text Editor with Ajax</a></li>
<li data-url="/content/4-MVC-View/5-Assignment.html"><a href="http://webcoursify.github.io/content/4-MVC-View/5-Assignment.html">4 - Assignments for View</a></li>
</ul>
</li>
<li data-url="/content/5-Topic-User.html">
<a href="http://webcoursify.github.io/content/5-Topic-User.html">
<span class="lesson-title">6 - User Management in WebApp</span>
</a>
</li>
<li data-url="/content/6-ProjectSpecification.html">
<a href="http://webcoursify.github.io/content/6-ProjectSpecification.html">
<span class="lesson-title">7 - Capstone Project Specification</span>
</a>
</li>
<li data-url="/content/99-ExtraMaterials">
<a href="http://webcoursify.github.io/content/99-ExtraMaterials">
<span class="lesson-title">8 - Extra Tutorials</span>
</a>
<ul class="section-list">
<li data-url="/content/99-ExtraMaterials/1-IntroToGit.html"><a href="http://webcoursify.github.io/content/99-ExtraMaterials/1-IntroToGit.html">1 - Introduction to Git</a></li>
<li data-url="/content/99-ExtraMaterials/2-Deployment.html"><a href="http://webcoursify.github.io/content/99-ExtraMaterials/2-Deployment.html">2 - Deployment</a></li>
</ul>
</li>
</ul>
</section>
<footer>
Copyright 2015 Tyrone Cheung
</footer>
<footer>
<p>
<b>This course has been finished just recently, and there're a
lot of improvements pending. If you like it, or think it's useful, or
start to go through the course content, please <a href="mailto:zhangty10@gmail.com">shoot me an email</a> to let me know. Thanks!</b>
</p>
</footer>
</aside>
<!-- Bootstrap core JavaScript-->
<!-- <script src="/js/jquery-1.10.2.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/hc.js"></script> -->
<script type="text/javascript" src="The%20View-User%20Interaction_files/jquery-2.js"></script>
<script type="text/javascript" async="" src="The%20View-User%20Interaction_files/saved_resource.js"></script>
<script type="text/javascript" async="" src="The%20View-User%20Interaction_files/inpage_linkid.js" id="undefined"></script>
<script type="text/javascript" async="" src="The%20View-User%20Interaction_files/library.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
(function(){try{var s,a,i,j,r,c,l=document.getElementsByTagName("a"),t=document.createElement("textarea");for(i=0;l.length-i;i++){try{a=l[i].getAttribute("href");if(a&&a.indexOf("/cdn-cgi/l/email-protection") > -1 && (a.length > 28)){s='';j=27+ 1 + a.indexOf("/cdn-cgi/l/email-protection");if (a.length > j) {r=parseInt(a.substr(j,2),16);for(j+=2;a.length>j&&a.substr(j,1)!='X';j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}j+=1;s+=a.substr(j,a.length-j);}t.innerHTML=s.replace(/</g,"<").replace(/>/g,">");l[i].setAttribute("href","mailto:"+t.value);}}catch(e){}}}catch(e){}})();
/* ]]> */
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-57962734-1', 'auto');
ga('send', 'pageview');
</script>
<script type="text/javascript">
var getLocation = function(href) {
var l = document.createElement("a");
l.href = href;
return l;
};
var pathname = getLocation(window.location.href).pathname;
if(pathname[pathname.length - 1] == '/')
pathname = pathname.substring(0, pathname.length - 1);
function setActive(){
var $this = $(this);
if($this.data('url') && pathname.indexOf($this.data('url')) == 0){
$(this).addClass('active');
}
}
$('ul.chapter-list li')
.each(setActive);
$('ul.section-list li')
.each(setActive);
</script>
</body></html>